当前位置: 首页>>代码示例>>Java>>正文


Java TreeElement.getChildAt方法代码示例

本文整理汇总了Java中org.javarosa.core.model.instance.TreeElement.getChildAt方法的典型用法代码示例。如果您正苦于以下问题:Java TreeElement.getChildAt方法的具体用法?Java TreeElement.getChildAt怎么用?Java TreeElement.getChildAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.javarosa.core.model.instance.TreeElement的用法示例。


在下文中一共展示了TreeElement.getChildAt方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addChildrenOfReference

import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
/**
 * This is a utility method to get all of the references of a node. It can
 * be replaced when we support dependent XPath Steps (IE: /path/to//)
 */
public void addChildrenOfReference(FormInstance mainInstance,
		EvaluationContext evalContext, TreeReference original,
		Set<TreeReference> toAdd, boolean expandRepeatables) {
	// original has already been added to the 'toAdd' list.

	TreeElement repeatTemplate = expandRepeatables ? mainInstance
			.getTemplatePath(original) : null;
	if (repeatTemplate != null) {
		for (int i = 0; i < repeatTemplate.getNumChildren(); ++i) {
			TreeElement child = repeatTemplate.getChildAt(i);
			toAdd.add(child.getRef().genericize());
			addChildrenOfElement(mainInstance, evalContext, child, toAdd, expandRepeatables);
		}
	} else {
		List<TreeReference> refSet = evalContext
				.expandReference(original);
		for (TreeReference ref : refSet) {
			addChildrenOfElement(mainInstance, evalContext, evalContext.resolveReference(ref),
					toAdd, expandRepeatables);
		}
	}
}
 
开发者ID:medic,项目名称:javarosa,代码行数:27,代码来源:Fast2014DagImpl.java

示例2: addChildrenOfReference

import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
/**
 * This is a utility method to get all of the references of a node. It can
 * be replaced when we support dependent XPath Steps (IE: /path/to//)
 */
private void addChildrenOfReference(FormInstance mainInstance,
      EvaluationContext evalContext, TreeReference original,
      Set<TreeReference> toAdd, boolean expandRepeatables) {
   // original has already been added to the 'toAdd' list.

   TreeElement repeatTemplate = expandRepeatables ? mainInstance
         .getTemplatePath(original) : null;
   if (repeatTemplate != null) {
      for (int i = 0; i < repeatTemplate.getNumChildren(); ++i) {
         TreeElement child = repeatTemplate.getChildAt(i);
         toAdd.add(child.getRef().genericize());
         addChildrenOfElement(mainInstance, evalContext, child, toAdd,
               expandRepeatables);
      }
   } else {
      List<TreeReference> refSet = evalContext.expandReference(original);
      for (TreeReference ref : refSet) {
         addChildrenOfElement(mainInstance, evalContext,
               evalContext.resolveReference(ref), toAdd,
               expandRepeatables);
      }
   }
}
 
开发者ID:medic,项目名称:javarosa,代码行数:28,代码来源:Safe2014DagImpl.java

示例3: findDepthFirst

import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
/**
 * Traverse the submission looking for the first matching tag in depth-first order.
 *
 * @param parent
 * @param name
 * @return
 */
private TreeElement findDepthFirst(TreeElement parent, String name) {
    int len = parent.getNumChildren();
    for ( int i = 0; i < len ; ++i ) {
        TreeElement e = parent.getChildAt(i);
        if ( name.equals(e.getName()) ) {
            return e;
        } else if ( e.getNumChildren() != 0 ) {
            TreeElement v = findDepthFirst(e, name);
            if ( v != null ) return v;
        }
    }
    return null;
}
 
开发者ID:Last-Mile-Health,项目名称:ODK-Liberia,代码行数:21,代码来源:FormController.java

示例4: findDepthFirst

import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
/**
 * Traverse the submission looking for the first matching tag in depth-first
 * order.
 *
 * @param parent
 * @param name
 * @return
 */
private TreeElement findDepthFirst(TreeElement parent, String name) {
  int len = parent.getNumChildren();
  for (int i = 0; i < len; ++i) {
    TreeElement e = parent.getChildAt(i);
    if (name.equals(e.getName())) {
      return e;
    } else if (e.getNumChildren() != 0) {
      TreeElement v = findDepthFirst(e, name);
      if (v != null)
        return v;
    }
  }
  return null;
}
 
开发者ID:opendatakit,项目名称:aggregate,代码行数:23,代码来源:BaseFormParserForJavaRosa.java

示例5: serializeTree

import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
public void serializeTree(TreeElement root) {
	for (int j = 0; j < root.getNumChildren(); j++) {
		TreeElement tee = root.getChildAt(j);
		if (tee.isLeaf()) {
			String e = serializeNode(tee);
			if(e != null) {
				theSmsStr += e;
			}
		}
		else {
			serializeTree(tee);
		}
	}
}
 
开发者ID:medic,项目名称:javarosa,代码行数:15,代码来源:SMSSerializingVisitor.java

示例6: addChildrenOfElement

import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
private void addChildrenOfElement(TreeElement el, ArrayList<TreeReference> toAdd) {
   for (int i = 0; i < el.getNumChildren(); ++i) {
      TreeElement child = el.getChildAt(i);
      toAdd.add(child.getRef().genericize());
      addChildrenOfElement(child, toAdd);
   }
}
 
开发者ID:medic,项目名称:javarosa,代码行数:8,代码来源:April2014DagImpl.java

示例7: removeInvalidTemplates

import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
private boolean removeInvalidTemplates (TreeElement instanceNode, TreeElement repeatTreeNode, boolean templateAllowed) {
	int mult = instanceNode.getMult();
	boolean repeatable = (repeatTreeNode == null ? false : repeatTreeNode.isRepeatable());

	if (mult == TreeReference.INDEX_TEMPLATE) {
		if (!templateAllowed) {
			reporter.warning(XFormParserReporter.TYPE_INVALID_STRUCTURE, "Template nodes for sub-repeats must be located within the template node of the parent repeat; ignoring template... [" + instanceNode.getName() + "]", null);
			return true;
		} else if (!repeatable) {
			reporter.warning(XFormParserReporter.TYPE_INVALID_STRUCTURE, "Warning: template node found for ref that is not repeatable; ignoring... [" + instanceNode.getName() + "]", null);
			return true;
		}
	}

	if (repeatable && mult != TreeReference.INDEX_TEMPLATE)
		templateAllowed = false;

	for (int i = 0; i < instanceNode.getNumChildren(); i++) {
		TreeElement child = instanceNode.getChildAt(i);
		TreeElement rchild = (repeatTreeNode == null ? null : repeatTreeNode.getChild(child.getName(), 0));

		if (removeInvalidTemplates(child, rchild, templateAllowed)) {
			instanceNode.removeChildAt(i);
			i--;
		}
	}
	return false;
}
 
开发者ID:medic,项目名称:javarosa,代码行数:29,代码来源:XFormParser.java

示例8: trimRepeatChildren

import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
private static void trimRepeatChildren (TreeElement node) {
	for (int i = 0; i < node.getNumChildren(); i++) {
		TreeElement child = node.getChildAt(i);
		if (child.isRepeatable()) {
			node.removeChildAt(i);
			i--;
		} else {
			trimRepeatChildren(child);
		}
	}
}
 
开发者ID:medic,项目名称:javarosa,代码行数:12,代码来源:XFormParser.java


注:本文中的org.javarosa.core.model.instance.TreeElement.getChildAt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。