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


Java TreeElement.getChildMultiplicity方法代码示例

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


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

示例1: setRepeatNextMultiplicity

import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
private boolean setRepeatNextMultiplicity(List<IFormElement> elements, List<Integer> multiplicities) {
	// find out if node is repeatable
	TreeReference nodeRef = form.getChildInstanceRef(elements, multiplicities);
	TreeElement node = form.getMainInstance().resolveReference(nodeRef);
	if (node == null || node.isRepeatable()) { // node == null if there are no
		// instances of the repeat
		int mult;
		if (node == null) {
			mult = 0; // no repeats; next is 0
		} else {
			String name = node.getName();
			TreeElement parentNode = form.getMainInstance().resolveReference(nodeRef.getParentRef());
			mult = parentNode.getChildMultiplicity(name);
		}
		multiplicities.set(multiplicities.size() - 1, Integer.valueOf(repeatStructure == REPEAT_STRUCTURE_NON_LINEAR ? TreeReference.INDEX_REPEAT_JUNCTURE : mult));
		return true;
	} else {
		return false;
	}
}
 
开发者ID:medic,项目名称:javarosa,代码行数:21,代码来源:FormEntryModel.java

示例2: writeTreeElement

import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
/**
 * recursively write out a node of the instance
 * @param out
 * @param e
 * @param ref
 * @throws IOException
 */
private void writeTreeElement (DataOutputStream out, TreeElement e) throws IOException {
	TreeElement templ = instance.getTemplatePath(e.getRef());
	boolean isGroup = !templ.isLeaf();

	if (isGroup) {
	   List<String> childTypesHandled = new ArrayList<String>(templ.getNumChildren());
		for (int i = 0; i < templ.getNumChildren(); i++) {
			String childName = templ.getChildAt(i).getName();
			if (!childTypesHandled.contains(childName)) {
				childTypesHandled.add(childName);

				int mult = e.getChildMultiplicity(childName);
				if (mult > 0 && !e.getChild(childName, 0).isRelevant()) {
					mult = 0;
				}

				ExtUtil.writeNumeric(out, mult);
				for (int j = 0; j < mult; j++) {
					writeTreeElement(out, e.getChild(childName, j));
				}
			}
		}
	} else {
		ExtUtil.write(out, new ExtWrapAnswerData(e.getDataType(), e.getValue()));
	}
}
 
开发者ID:medic,项目名称:javarosa,代码行数:34,代码来源:CompactInstanceWrapper.java

示例3: mergeDataModel

import org.javarosa.core.model.instance.TreeElement; //导入方法依赖的package包/类
public static void mergeDataModel (FormInstance parent, FormInstance child, TreeReference parentRef) {
	TreeElement parentNode = parent.resolveReference(parentRef);
	//ugly
	if (parentNode == null) {
		parentRef = parent.addNode(parentRef);
		parentNode = parent.resolveReference(parentRef);
	}
	TreeElement childNode = child.getRoot();

	int mult = parentNode.getChildMultiplicity(childNode.getName());
	childNode.setMult(mult);

	parentNode.addChild(childNode);
}
 
开发者ID:medic,项目名称:javarosa,代码行数:15,代码来源:RestoreUtils.java


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