当前位置: 首页>>代码示例>>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;未经允许,请勿转载。