當前位置: 首頁>>代碼示例>>Java>>正文


Java XMLNode.getChildren方法代碼示例

本文整理匯總了Java中edu.mit.csail.sdg.alloy4.XMLNode.getChildren方法的典型用法代碼示例。如果您正苦於以下問題:Java XMLNode.getChildren方法的具體用法?Java XMLNode.getChildren怎麽用?Java XMLNode.getChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在edu.mit.csail.sdg.alloy4.XMLNode的用法示例。


在下文中一共展示了XMLNode.getChildren方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: parseAlloyRelation

import edu.mit.csail.sdg.alloy4.XMLNode; //導入方法依賴的package包/類
/** Return null if the element is malformed. */
private static AlloyRelation parseAlloyRelation(VizState now, XMLNode x) {
	/*
	 * <relation name="name"> 2 or more <type name=".."/> </relation>
	 */
	List<AlloyType> ans = new ArrayList<AlloyType>();
	if (!x.is("relation"))
		return null;
	String name = x.getAttribute("name");
	if (name.length() == 0)
		return null;
	for (XMLNode sub : x.getChildren("type")) {
		String typename = sub.getAttribute("name");
		if (typename.length() == 0)
			return null;
		AlloyType t = now.getCurrentModel().hasType(typename);
		if (t == null)
			return null;
		ans.add(t);
	}
	if (ans.size() < 2)
		return null;
	else
		return now.getCurrentModel().hasRelation(name, ans);
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:26,代碼來源:StaticThemeReaderWriter.java

示例2: parseProjectionList

import edu.mit.csail.sdg.alloy4.XMLNode; //導入方法依賴的package包/類
/** Always returns a nonnull (though possibly empty) set of AlloyType. */
private static Set<AlloyType> parseProjectionList(VizState now, XMLNode x) {
	/*
	 * <projection> 0 or more <type name=".."/> </projection>
	 */
	Set<AlloyType> ans = new TreeSet<AlloyType>();
	if (x.is("projection"))
		for (XMLNode sub : x.getChildren("type")) {
			String name = sub.getAttribute("name");
			if (name.length() == 0)
				continue;
			AlloyType t = now.getOriginalModel().hasType(name);
			if (t != null)
				ans.add(t);
		}
	return ans;
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:18,代碼來源:StaticThemeReaderWriter.java

示例3: parseAlloyRelation

import edu.mit.csail.sdg.alloy4.XMLNode; //導入方法依賴的package包/類
/** Return null if the element is malformed. */
private static AlloyRelation parseAlloyRelation(VizState now, XMLNode x) {
   /*
    * <relation name="name">
    *   2 or more <type name=".."/>
    * </relation>
    */
   List<AlloyType> ans=new ArrayList<AlloyType>();
   if (!x.is("relation")) return null;
   String name=x.getAttribute("name");
   if (name.length()==0) return null;
   for(XMLNode sub:x.getChildren("type")) {
      String typename=sub.getAttribute("name");
      if (typename.length()==0) return null;
      AlloyType t = now.getCurrentModel().hasType(typename);
      if (t==null) return null;
      ans.add(t);
   }
   if (ans.size()<2) return null; else return now.getCurrentModel().hasRelation(name, ans);
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:21,代碼來源:StaticThemeReaderWriter.java

示例4: parseProjectionList

import edu.mit.csail.sdg.alloy4.XMLNode; //導入方法依賴的package包/類
/** Always returns a nonnull (though possibly empty) set of AlloyType. */
private static Set<AlloyType> parseProjectionList(VizState now, XMLNode x) {
   /*
    * <projection>
    *   0 or more <type name=".."/>
    * </projection>
    */
   Set<AlloyType> ans=new TreeSet<AlloyType>();
   if (x.is("projection")) for(XMLNode sub:x.getChildren("type")) {
      String name=sub.getAttribute("name");
      if (name.length()==0) continue;
      AlloyType t = now.getOriginalModel().hasType(name);
      if (t!=null) ans.add(t);
   }
   return ans;
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:17,代碼來源:StaticThemeReaderWriter.java

示例5: readAlloy

import edu.mit.csail.sdg.alloy4.XMLNode; //導入方法依賴的package包/類
/**
 * Read the XML file and merge its settings into an existing VizState
 * object.
 */
public static void readAlloy(String filename, VizState theme) throws IOException {
	File file = new File(filename);
	try {
		XMLNode elem = new XMLNode(file);
		for (XMLNode sub : elem.getChildren("view"))
			parseView(sub, theme);
	} catch (Throwable e) {
		throw new IOException(
				"The file \"" + file.getPath() + "\" is not a valid XML file, or an error occurred in reading.");
	}
}
 
開發者ID:AlloyTools,項目名稱:org.alloytools.alloy,代碼行數:16,代碼來源:StaticThemeReaderWriter.java

示例6: readAlloy

import edu.mit.csail.sdg.alloy4.XMLNode; //導入方法依賴的package包/類
/** Read the XML file and merge its settings into an existing VizState object. */
public static void readAlloy(String filename, VizState theme) throws IOException {
   File file = new File(filename);
   try {
      XMLNode elem = new XMLNode(file);
      for(XMLNode sub: elem.getChildren("view")) parseView(sub,theme);
   } catch(Throwable e) {
      throw new IOException("The file \""+file.getPath()+"\" is not a valid XML file, or an error occurred in reading.");
   }
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:11,代碼來源:StaticThemeReaderWriter.java


注:本文中的edu.mit.csail.sdg.alloy4.XMLNode.getChildren方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。