本文整理汇总了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;
}
}
示例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()));
}
}
示例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);
}