Package org.htmlunit.xpath.axes
Class FilterExprWalker
- java.lang.Object
-
- org.htmlunit.xpath.Expression
-
- org.htmlunit.xpath.patterns.NodeTest
-
- org.htmlunit.xpath.axes.PredicatedNodeTest
-
- org.htmlunit.xpath.axes.AxesWalker
-
- org.htmlunit.xpath.axes.FilterExprWalker
-
- All Implemented Interfaces:
java.lang.Cloneable,javax.xml.transform.SourceLocator,PathComponent,SubContextList,ExpressionNode,XPathVisitable
public class FilterExprWalker extends AxesWalker
Walker for the OP_VARIABLE, or OP_FUNCTION, or OP_GROUP, op codes.- See Also:
- XPath FilterExpr descriptions
-
-
Field Summary
Fields Modifier and Type Field Description private Expressionm_exprThe contained expression.private XNodeSetm_exprObjThe result of executing m_expr.-
Fields inherited from class org.htmlunit.xpath.axes.AxesWalker
m_axis, m_isFresh, m_nextWalker, m_prevWalker, m_root, m_traverser
-
Fields inherited from class org.htmlunit.xpath.axes.PredicatedNodeTest
DEBUG_PREDICATECOUNTING, m_foundLast, m_lpi, m_predCount, m_predicateIndex, m_proximityPositions
-
Fields inherited from class org.htmlunit.xpath.patterns.NodeTest
m_name, m_whatToShow, SCORE_NODETEST, SCORE_NONE, SCORE_NSWILD, SCORE_OTHER, SCORE_QNAME, SHOW_BYFUNCTION, WILD
-
-
Constructor Summary
Constructors Constructor Description FilterExprWalker(WalkingIterator locPathIterator)Construct a FilterExprWalker using a LocPathIterator.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description shortacceptNode(int n)Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator.voidcallPredicateVisitors(XPathVisitor visitor)This will traverse the heararchy, calling the visitor for each member.java.lang.Objectclone()booleandeepEquals(Expression expr)Compare this object with another object and see if they are equal, include the sub heararchy.voiddetach()Detaches the walker from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.static XNodeSetexecuteFilterExpr(int context, XPathContext xctxt, PrefixResolver prefixResolver, boolean isTopLevel, Expression expr)Execute the expression.intgetAnalysisBits()Get the analysis bits for this path component, as defined in the WalkerFactory.intgetAxis()Returns the axis being iterated, if it is known.intgetLastPos(XPathContext xctxt)Get the number of nodes in the node list, which, in the XSLT 1 based counting system, is the last index position.intgetNextNode()Get the next node in document order on the axes.voidinit(Compiler compiler, int opPos, int stepType)Initialize an AxesWalker during the parse of the XPath expression.voidsetRoot(int root)Set the root node of the TreeWalker.-
Methods inherited from class org.htmlunit.xpath.axes.AxesWalker
callVisitors, cloneDeep, findClone, getDTM, getNextWalker, getRoot, nextNode, setNextWalker, setPrevWalker, wi
-
Methods inherited from class org.htmlunit.xpath.axes.PredicatedNodeTest
canTraverseOutsideSubtree, countProximityPosition, executePredicates, getPredicate, getPredicateCount, getProximityPosition, getProximityPosition, getProximityPosition, initPredicateInfo, initProximityPosition, isReverseAxes, nodeToString, resetProximityPositions, setLocPathIterator, setPredicateCount
-
Methods inherited from class org.htmlunit.xpath.patterns.NodeTest
calcScore, execute, execute, execute, getLocalName, getNamespace, getNodeTypeTest, getStaticScore, getWhatToShow, initNodeTest, initNodeTest, setLocalName, setNamespace, setStaticScore, setWhatToShow
-
Methods inherited from class org.htmlunit.xpath.Expression
asIterator, asNode, assertion, bool, error, execute, exprGetParent, exprSetParent, getColumnNumber, getExpressionOwner, getLineNumber, getPublicId, getSystemId, isSameClass, isStableNumber, num
-
-
-
-
Field Detail
-
m_expr
private Expression m_expr
The contained expression. Should be non-null.
-
m_exprObj
private transient XNodeSet m_exprObj
The result of executing m_expr. Needs to be deep cloned on clone op.
-
-
Constructor Detail
-
FilterExprWalker
public FilterExprWalker(WalkingIterator locPathIterator)
Construct a FilterExprWalker using a LocPathIterator.- Parameters:
locPathIterator- non-null reference to the parent iterator.
-
-
Method Detail
-
init
public void init(Compiler compiler, int opPos, int stepType) throws javax.xml.transform.TransformerException
Initialize an AxesWalker during the parse of the XPath expression.- Overrides:
initin classAxesWalker- Parameters:
compiler- The Compiler object that has information about this walker in the op map.opPos- The op code position of this location step.stepType- The type of location step.- Throws:
javax.xml.transform.TransformerException- if any
-
detach
public void detach()
Detaches the walker from the set which it iterated over, releasing any computational resources and placing the iterator in the INVALID state.- Overrides:
detachin classAxesWalker
-
setRoot
public void setRoot(int root)
Set the root node of the TreeWalker. (Not part of the DOM2 TreeWalker interface).- Overrides:
setRootin classAxesWalker- Parameters:
root- The context node of this step.
-
executeFilterExpr
public static XNodeSet executeFilterExpr(int context, XPathContext xctxt, PrefixResolver prefixResolver, boolean isTopLevel, Expression expr) throws WrappedRuntimeException
Execute the expression. Meant for reuse by other FilterExpr iterators that are not derived from this object.- Throws:
WrappedRuntimeException
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classAxesWalker- Throws:
java.lang.CloneNotSupportedException
-
acceptNode
public short acceptNode(int n)
Test whether a specified node is visible in the logical view of a TreeWalker or NodeIterator. This function will be called by the implementation of TreeWalker and NodeIterator; it is not intended to be called directly from user code.- Overrides:
acceptNodein classPredicatedNodeTest- Parameters:
n- The node to check to see if it passes the filter or not.- Returns:
- a constant to determine whether the node is accepted, rejected, or skipped, as defined above .
-
getNextNode
public int getNextNode()
Get the next node in document order on the axes.- Overrides:
getNextNodein classAxesWalker- Returns:
- the next node in document order on the axes, or null.
-
getLastPos
public int getLastPos(XPathContext xctxt)
Get the number of nodes in the node list, which, in the XSLT 1 based counting system, is the last index position.- Specified by:
getLastPosin interfaceSubContextList- Overrides:
getLastPosin classAxesWalker- Parameters:
xctxt- The XPath runtime context.- Returns:
- the number of nodes in the node list.
-
getAnalysisBits
public int getAnalysisBits()
Get the analysis bits for this path component, as defined in the WalkerFactory.- Specified by:
getAnalysisBitsin interfacePathComponent- Overrides:
getAnalysisBitsin classAxesWalker- Returns:
- One of WalkerFactory#BIT_DESCENDANT, etc.
-
getAxis
public int getAxis()
Returns the axis being iterated, if it is known.- Overrides:
getAxisin classAxesWalker- Returns:
- Axis.CHILD, etc., or -1 if the axis is not known or is of multiple types.
-
callPredicateVisitors
public void callPredicateVisitors(XPathVisitor visitor)
This will traverse the heararchy, calling the visitor for each member. If the called visitor method returns false, the subtree should not be called.- Overrides:
callPredicateVisitorsin classPredicatedNodeTest- Parameters:
visitor- The visitor whose appropriate method will be called.
-
deepEquals
public boolean deepEquals(Expression expr)
Compare this object with another object and see if they are equal, include the sub heararchy.- Overrides:
deepEqualsin classAxesWalker- Parameters:
expr- Another expression object.- Returns:
- true if this objects class and the expr object's class are the same, and the data contained within both objects are considered equal.
-
-