From: Wolfgang M. M. <wol...@us...> - 2004-04-16 14:41:46
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15791/src/org/exist/xquery/functions Modified Files: FunNot.java Log Message: not() function produced wrong results. Index: FunNot.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/FunNot.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** FunNot.java 29 Jan 2004 15:06:41 -0000 1.1 --- FunNot.java 16 Apr 2004 14:41:37 -0000 1.2 *************** *** 21,25 **** package org.exist.xquery.functions; - import org.exist.dom.ContextItem; import org.exist.dom.ExtArrayNodeSet; import org.exist.dom.NodeProxy; --- 21,24 ---- *************** *** 31,36 **** import org.exist.xquery.Function; import org.exist.xquery.FunctionSignature; - import org.exist.xquery.XQueryContext; import org.exist.xquery.XPathException; import org.exist.xquery.value.BooleanValue; import org.exist.xquery.value.Item; --- 30,35 ---- import org.exist.xquery.Function; import org.exist.xquery.FunctionSignature; import org.exist.xquery.XPathException; + import org.exist.xquery.XQueryContext; import org.exist.xquery.value.BooleanValue; import org.exist.xquery.value.Item; *************** *** 87,115 **** Sequence argSeq = arg.eval(contextSequence, contextItem); ! LOG.debug("not argument: " + argSeq.getLength()); ! NodeProxy parent; ! long pid; ! ContextItem contextNode; ! NodeProxy next; ! Item item; ! // iterate through nodes and remove hits from result ! for (SequenceIterator i = argSeq.iterate(); i.hasNext();) { ! item = (Item) i.nextItem(); ! current = (NodeProxy) item; ! contextNode = current.getContext(); ! if (contextNode == null) { ! LOG.warn("context node is missing!"); ! break; ! } ! ! while (contextNode != null) { ! next = contextNode.getNode(); ! //if ((parent = result.get(next)) != null) ! result.remove(next); ! contextNode = contextNode.getNextItem(); ! } ! } ! LOG.debug("found " + result.getLength()); ! return result; // case 2: simply invert the boolean value } else { --- 86,91 ---- Sequence argSeq = arg.eval(contextSequence, contextItem); ! NodeSet argSet = argSeq.toNodeSet().getContextNodes(true); ! return result.except(argSet); // case 2: simply invert the boolean value } else { |