parent = context.parentWithChild(n, false, true);
parent = contextSet.parentWithChild(n, false, true);
	protected Value nodeSetCompare(		Expression left,		Expression right,		DocumentSet docs,		NodeSet context,		NodeProxy node) {		NodeSet result = new ArraySet(100);		if (right.returnsType() == Constants.TYPE_STRING ||			right.returnsType() == Constants.TYPE_NODELIST) {			// evaluate left expression			NodeSet nodes = (NodeSet) left.eval(docs, context, null).getNodeList();			String cmp = right.eval(docs, context, null).getStringValue();			if (getLeft().returnsType() == Constants.TYPE_NODELIST && relation == Constants.EQ &&				nodes.hasIndex() && cmp.length() > 0) {				cmp = cmp.replace('%', '*');				// try to use a fulltext search expression to reduce the number				// of potential nodes to scan through				SimpleTokenizer tokenizer = new SimpleTokenizer();				tokenizer.setText(cmp);				TextToken token;				String term;				boolean foundNumeric = false;				// setup up an &= expression using the fulltext index				containsExpr = new FunContains(pool, Constants.FULLTEXT_AND);				for (int i = 0; i < 5 && (token = tokenizer.nextToken(true)) != null; i++) {					// remember if we find an alphanumeric token					if(token.getType() == TextToken.ALPHANUM)						foundNumeric = true;					containsExpr.addTerm(token.getText());				} 				// check if all elements are indexed. If not, we can't use the				// fulltext index.				if(foundNumeric)					foundNumeric = checkArgumentTypes(docs);				if(!foundNumeric) {					// all elements are indexed: use the fulltext index					Value temp = containsExpr.eval(docs, nodes, null);					nodes = (NodeSet) temp.getNodeList();				}				cmp = cmp.replace('*', '%');			}			// now compare the input node set to the search expression			DBBroker broker = null;			try {				broker = pool.get();				result = broker.getNodesEqualTo(nodes, docs, relation, cmp);			} catch (EXistException e) {				e.printStackTrace();			} finally {				pool.release(broker);			}		} else if (right.returnsType() == Constants.TYPE_NUM) {			double rvalue;			double lvalue;			NodeProxy ln;			NodeSet temp;			NodeSet lset = (NodeSet) left.eval(docs, context, null).getNodeList();			for (Iterator i = lset.iterator(); i.hasNext();) {				ln = (NodeProxy) i.next();				try {					lvalue = Double.parseDouble(ln.getNodeValue());				} catch (NumberFormatException nfe) {					continue;				}				temp = new SingleNodeSet(ln);				rvalue = right.eval(docs, temp, ln).getNumericValue();				if (cmpNumbers(lvalue, rvalue))					result.add(ln);			}		} else if (right.returnsType() == Constants.TYPE_BOOL) {			NodeProxy n;			NodeProxy parent;			boolean rvalue;			boolean lvalue;			long pid;			ArraySet leftNodeSet;			ArraySet temp;			// get left arguments node set			leftNodeSet = (ArraySet) left.eval(docs, context, null).getNodeList();			temp = new ArraySet(10);			// get that part of context for which left argument's node set would			// be > 0			for (Iterator i = leftNodeSet.iterator(); i.hasNext();) {				n = (NodeProxy) i.next();				parent = context.parentWithChild(n, false, true);				if (parent != null)					temp.add(parent);			}			// now compare every node of context with the temporary set			for (Iterator i = context.iterator(); i.hasNext();) {				n = (NodeProxy) i.next();				lvalue = temp.contains(n);				rvalue = right.eval(docs, context, n).getBooleanValue();				if (cmpBooleans(lvalue, rvalue))					result.add(n);			}		}		return new ValueNodeSet(result);	}