public NodeSet selectAncestors(NodeSet other, boolean includeSelf, boolean rememberContext) {
public NodeSet selectAncestors(NodeSet other, boolean includeSelf, int contextId) {
	public NodeSet selectAncestors(NodeSet other, boolean includeSelf, boolean rememberContext) {		if (!(other instanceof ArraySet))			return super.selectAncestors(other, includeSelf, rememberContext);		ArraySet al = (ArraySet) other;		if (al.counter == 0 || counter == 0)			return new ArraySet(1);		long start = System.currentTimeMillis();		al.sort();		sort();		// the descendant set will be modified: copy if required 		NodeProxy[] dl = copyNodeSet(al, this);		//NodeSet result = new NodeIDSet();		NodeSet result = new ArraySet(getLength());		NodeProxy temp;		int ax;		int dx;		int cmp;		final int dlen = dl.length;		boolean more = includeSelf ? true : getParentSet(dl, dlen);		while (more) {			ax = 0;			dx = 0;			//more = getParentSet(dl);			while (dx < dlen) {				if (dl[dx] == null) { // || dl[dx].gid < 1) {					dx++;					System.out.println("skipping " + dx);					continue;				}				//System.out.println(dl[dx].gid + " == " + al.nodes[ax].gid);				cmp = dl[dx].compareTo(al.nodes[ax]);				if (cmp > 0) {					if (ax < al.counter - 1)						ax++;					else						break;				} else if (cmp < 0)					dx++;				else {					// found a matching node					if ((temp = result.get(al.nodes[ax])) == null) {						// remember the ancestor-node						al.nodes[ax].addMatches(nodes[dx]);						if (rememberContext)							al.nodes[ax].addContextNode(nodes[dx]);						else							al.nodes[ax].copyContext(nodes[dx]);						result.add(al.nodes[ax]);						//System.out.println("found: " + al.nodes[ax]);					} else if (rememberContext)						temp.addContextNode(nodes[dx]);					dx++;				}			}			// calculate parent id for each node in the			// descendant set. Returns false if no more			// valid nodes are found			more = getParentSet(dl, dlen);		}		LOG.debug(			"getAncestors found "				+ result.getLength()				+ " in "				+ (System.currentTimeMillis() - start)				+ "ms.");		return result;	}