summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2006-05-24 11:56:31 (EDT)
committer pelder2006-05-24 11:56:31 (EDT)
commit0e64df096afc846a915777cdea9806e22af45ab0 (patch)
treeaa292ab35547120558855736aecdfb49fcb759c0
parent5fc44c889288fa780a2875b794c6a7f565c133fb (diff)
downloadorg.eclipse.jet-0e64df096afc846a915777cdea9806e22af45ab0.zip
org.eclipse.jet-0e64df096afc846a915777cdea9806e22af45ab0.tar.gz
org.eclipse.jet-0e64df096afc846a915777cdea9806e22af45ab0.tar.bz2
[143305] Implement evaluate() for descendent-or-self axis.
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/ast/Axis.java20
1 files changed, 18 insertions, 2 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/ast/Axis.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/ast/Axis.java
index bb9f94f..96e9a16 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/ast/Axis.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/xpath/ast/Axis.java
@@ -19,6 +19,7 @@ package org.eclipse.jet.internal.xpath.ast;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.Iterator;
import java.util.Map;
import org.eclipse.jet.internal.xpath.NodeSetImpl;
@@ -246,8 +247,23 @@ public abstract class Axis
public NodeSet evaluate(NodeTest nodeTest, Context context)
{
- // TODO Implement this
- throw new UnsupportedOperationException("not implemented"); //$NON-NLS-1$
+ NodeSet result = new NodeSetImpl();
+ result.add(context.getContextNode());
+ nodeTest.filter(result);
+
+
+ NodeSet children = childAxis().evaluate(NodeTest.allNodes(), context);
+
+ int contextPos = 1;
+ for (Iterator i = children.iterator(); i.hasNext(); contextPos += 1)
+ {
+ Object object = (Object)i.next();
+ Context subcontext = context.newSubContext(object, contextPos, children.size());
+
+ result.addAll(evaluate(nodeTest, subcontext));
+ }
+
+ return result;
}
public NodeKind principalNodeKind()