public void appendChildren(IUAElement[] children) { if (this.children == null && children.length > 0) { this.children = new ArrayList<>(4); } for (int i=0;i<children.length;i++) { appendChild(children[i] instanceof UAElement ? (UAElement)children[i] : UAElementFactory.newElement(children[i])); } }
private void sort(UAElement element, ITopic[] children) { // sort children if (children.length > 1) { for (int i=0;i<children.length;++i) { element.removeChild((UAElement)children[i]); } Arrays.sort(children, comparator); for (int i=0;i<children.length;++i) { element.appendChild((UAElement)children[i]); } } } }
a.appendChild(childB); entriesByKeyword.put(keyword, childB); if (!topicHrefs.contains(href)) { a.appendChild(childB); topicHrefs.add(href); if (!seeTargets.contains((childB))) { a.appendChild(childB); seeTargets.add((IndexSee) childB);
} else { a.appendChild(childB); criterionById.put(idB, childB); if (!criterionValueIds.contains(valueIdB)) { a.appendChild(childB); criterionValueIds.add(valueIdB);
private boolean sortAndPrune(UAElement element, IndexComparator comparator) { // sort children IUAElement[] children = element.getChildren(); if (children.length > 1) { for (int i=0;i<children.length;++i) { element.removeChild((UAElement)children[i]); } Arrays.sort(children, comparator); for (int i=0;i<children.length;++i) { element.appendChild((UAElement)children[i]); } } // sort children's children boolean hasChildren = false; for (int i=0;i<children.length;++i) { hasChildren = hasChildren | sortAndPrune((UAElement)children[i], comparator); } if (element instanceof IIndexEntry && !hasChildren) { element.getParentElement().removeChild(element); return false; } if (element instanceof IndexSee && !isValidSeeReference((IndexSee) element)) { element.getParentElement().removeChild(element); return false; } return true; }