nodes[dx].addMatches(al.nodes[ax].match);
nodes[dx].addMatches(al.nodes[ax]);
	public NodeSet getDescendantsX(		NodeSet other,		int mode,		boolean includeSelf,		boolean rememberContext) {		//		if (other.getLength() < CHOOSE_TOP_DOWN_MAX)		//			return getDescendantsTopDown(other, mode, rememberContext);		if (!(other instanceof ArraySet))			return super.selectAncestorDescendant(				other,				mode,				includeSelf,				rememberContext);		ArraySet al = (ArraySet) other;		if (al.counter == 0 || counter == 0)			return NodeSet.EMPTY_SET;		long start = System.currentTimeMillis();		al.sort();		sort();		// the descendant set will be modified: copy if required 		NodeProxy[] dl = null;		if (mode == DESCENDANT) {			dl = copyNodeSet(al, this);			//			dl = new NodeProxy[counter];			//			LOG.debug("copying " + counter + " nodes");			//			for(int i = 0; i < dl.length; i++) {			//				dl[i] = new NodeProxy( nodes[i] );			//			}			//			LOG.debug("nodes copied");		} else			dl = nodes;		ArraySet result = new ArraySet(dl.length);		//result.sorted = true;		int ax;		int dx;		int cmp;		NodeProxy node;		final int dlen = dl.length;		boolean more = includeSelf ? true : getParentSet(dl, dlen);		while (more) {			ax = 0;			dx = 0;			while (dx < dlen) {				if (dl[dx] == null) { // || dl[dx].gid < 1) {					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					switch (mode) {						case ANCESTOR :							// remember the ancestor-node							al.nodes[ax].addMatches(dl[dx].match);							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]);							break;						case DESCENDANT :							// remember the descendant-node							nodes[dx].addMatches(al.nodes[ax].match);							if (rememberContext)								nodes[dx].addContextNode(al.nodes[ax]);							else								nodes[dx].copyContext(al.nodes[ax]);							result.add(nodes[dx]);							break;					}					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(			"getDescendants found "				+ result.getLength()				+ " in "				+ (System.currentTimeMillis() - start)				+ "ms.");		return result;	}