public void selectParentChild(NodeSet result, NodeProxy na, Iterator ia, int mode, int contextId) {
public void selectParentChild(NodeSet result, NodeProxy na, NodeSetIterator ia, int mode, int contextId) {
        public void selectParentChild(NodeSet result, NodeProxy na, Iterator ia, int mode, int contextId) {        	if (length == 0)        		return;        	int pos = 0;        	int startPos = 0;        	NodeProxy nb = array[pos];        	while (true) {        		// first, try to find nodes belonging to the same doc    			if (na.getDocument().getDocId() != nb.getDocument().getDocId())    				break;    			    			// same document    			NodeId pa = na.getNodeId();    			NodeId pb = nb.getNodeId();    			int relation = pb.computeRelation(pa);    			if (relation != -1) {    				if (relation == NodeId.IS_CHILD) {    					if(mode == NodeSet.DESCENDANT) {    						if (Expression.NO_CONTEXT_ID != contextId)    							nb.addContextNode(contextId, na);    						else    							nb.copyContext(na);    						result.add(nb);    					} else {    						if (Expression.NO_CONTEXT_ID != contextId)    							na.addContextNode(contextId, nb);    						else    							na.copyContext(nb);    						result.add(na);    					}    				}    				if (++pos < length)    					nb = array[pos];                    else if (ia.hasNext()) {                        NodeProxy next = (NodeProxy) ia.next();                        if (next.getNodeId().isDescendantOf(pa)) {                            pos = startPos;                            nb = array[pos];                            na = next;                            startPos = pos;                        } else                            break;                    } else                        break;    			} else {    				int cmp = pa.compareTo(pb);    				if (cmp < 0) {    					if (ia.hasNext()) {    						NodeProxy next = (NodeProxy) ia.next();    						if (next.getNodeId().isDescendantOf(pa)) {    							pos = startPos;    							nb = array[pos];    						}    						na = next;    						startPos = pos;    					} else    						break;    				} else {    					if (++pos < length)    						nb = array[pos];    					else    						break;    				}    			}        	}        }