Package org.loboevolution.apache.xpath
Class XPathVisitor
java.lang.Object
org.loboevolution.apache.xpath.XPathVisitor
- Direct Known Subclasses:
HasPositionalPredChecker
A derivation from this class can be passed to a class that implements the XPathVisitable
interface, to have the appropriate method called for each component of the XPath. Aside from
possible other uses, the main intention is to provide a reasonable means to perform expression
rewriting.
Each method has the form
boolean visitComponentType(ExpressionOwner owner, ComponentType compType). The
ExpressionOwner argument is the owner of the component, and can be used to reset the expression
for rewriting. If a method returns false, the sub hierarchy will not be traversed.
This class is meant to be a base class that will be derived by concrete classes, and doesn't much except return true for each method.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanVisit a binary operation.booleanvisitFunction(Function func) Visit a function.booleanVisit a LocationPath.booleanVisit a match pattern.voidVisit a number literal.booleanvisitPredicate(Expression pred) Visit a predicate within a location path.booleanVisit a step within a location path.voidVisit a string literal.booleanVisit a unary operation.booleanVisit a UnionPath.voidVisit a union pattern.
-
Constructor Details
-
XPathVisitor
public XPathVisitor()
-
-
Method Details
-
visitLocationPath
public boolean visitLocationPath()Visit a LocationPath.- Returns:
- true if the sub expressions should be traversed.
-
visitUnionPath
public boolean visitUnionPath()Visit a UnionPath.- Returns:
- true if the sub expressions should be traversed.
-
visitStep
public boolean visitStep()Visit a step within a location path.- Returns:
- true if the sub expressions should be traversed.
-
visitPredicate
Visit a predicate within a location path. Note that there isn't a proper unique component for predicates, and that the expression will be called also for whatever type Expression is.- Parameters:
pred- The predicate object.- Returns:
- true if the sub expressions should be traversed.
-
visitBinaryOperation
public boolean visitBinaryOperation()Visit a binary operation.- Returns:
- true if the sub expressions should be traversed.
-
visitUnaryOperation
public boolean visitUnaryOperation()Visit a unary operation.- Returns:
- true if the sub expressions should be traversed.
-
visitFunction
Visit a function.- Parameters:
func- The function reference object.- Returns:
- true if the sub expressions should be traversed.
-
visitMatchPattern
public boolean visitMatchPattern()Visit a match pattern.- Returns:
- true if the sub expressions should be traversed.
-
visitUnionPattern
public void visitUnionPattern()Visit a union pattern. -
visitStringLiteral
public void visitStringLiteral()Visit a string literal. -
visitNumberLiteral
public void visitNumberLiteral()Visit a number literal.
-