public NodeSet getChildren(DocumentImpl doc, long gid) { int level = doc.getTreeLevel(gid);  long pid = (gid - doc.getLevelStartPoint(level)) / doc.getTreeLevelOrder(level) + doc.getLevelStartPoint(level - 1);  long f_gid = (pid - doc.getLevelStartPoint(level - 1)) * doc.getTreeLevelOrder(level) + doc.getLevelStartPoint(level);  long e_gid = f_gid + doc.getTreeLevelOrder(level);  NodeSet set = getRange(doc, f_gid, e_gid); return set;
public ArraySet getChildren( NodeSet ancestors, int mode, boolean rememberContext) { if (ancestors.getLength() < CHOOSE_TOP_DOWN_MAX) return getChildrenTopDown(ancestors, mode, rememberContext); if (!(ancestors instanceof ArraySet)) return super.getChildren(ancestors, mode, rememberContext); ArraySet al = (ArraySet) ancestors; if (al.counter == 0 || counter == 0) { return new ArraySet(1); }  sort(); al.sort(); final ArraySet result = new ArraySet(al.counter);  NodeProxy[] dl = null; if (mode == DESCENDANT) { dl = copyNodeSet(al, this); result.sorted = true; } else dl = nodes;  int ax = 0; int dx = 0; final int dlen = dl.length; int cmp; getParentSet(dl, dlen); while (dx < dlen) { while (dl[dx] == null && ++dx < dlen); if (dx == dlen) break;         cmp = dl[dx].compareTo(al.nodes[ax]); if (cmp > 0) { if (ax < al.counter - 1) ax++; else break; } else if (cmp < 0) dx++; else { switch (mode) { case ANCESTOR : al.nodes[ax].addMatches(dl[dx].matches); if (rememberContext) al.nodes[ax].addContextNode(dl[dx]); else al.nodes[ax].copyContext(dl[dx]); result.add(al.nodes[ax]); break; case DESCENDANT : nodes[dx].addMatches(al.nodes[ax].matches); if (rememberContext) nodes[dx].addContextNode(al.nodes[ax]); else nodes[dx].copyContext(al.nodes[ax]); result.add(nodes[dx]); break; } dx++; } }       return result;
	public NodeSet getChildren(DocumentImpl doc, long gid) {		int level = doc.getTreeLevel(gid);		// get parents id		long pid =			(gid - doc.getLevelStartPoint(level)) / doc.getTreeLevelOrder(level)				+ doc.getLevelStartPoint(level - 1);		// get first childs id		long f_gid =			(pid - doc.getLevelStartPoint(level - 1)) * doc.getTreeLevelOrder(level)				+ doc.getLevelStartPoint(level);		// get last childs id		long e_gid = f_gid + doc.getTreeLevelOrder(level);		// get all nodes between first and last childs id		NodeSet set = getRange(doc, f_gid, e_gid);		return set;	}