Interface FilterVisitor
- All Known Implementing Classes:
BranchNormalizedVisitor
public interface FilterVisitor
Filter expression tree node visitor interface. Note that this is a variation
of the extrinsic visitor variation. It has the following advantages over the
standard visitor pattern:
- Visitor takes responsibility that a visitor can visit a node
- Each visitor knows which types of concrete classes it can visit
- New visitors can be created without changing the node class
- New node classes can be added without having to change old visitors
- Visitation order can be controled in every respect:
-
- Visitation rejection with canVisit() and/or getOrder()
- Recursive visitation ordering with isPrefix()
- Child visitation ordering with getOrder()
- Author:
- Apache Directory Project
-
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks to see if a node can be visited.getOrder(BranchNode node, List<ExprNode> children) Get the array of children to visit sequentially to determine the order of child visitations.booleanisPrefix()Determines whether the visitation order is prefix or postfix.Visits a filter expression AST using a specific visitation order.
-
Method Details
-
visit
-
canVisit
Checks to see if a node can be visited.- Parameters:
node- the node to be visited- Returns:
- whether or node the node should be visited
-
isPrefix
boolean isPrefix()Determines whether the visitation order is prefix or postfix.- Returns:
- true if the visitation is in prefix order, false otherwise.
-
getOrder
Get the array of children to visit sequentially to determine the order of child visitations. Some children may not be returned at all if canVisit() returns false on them.- Parameters:
node- the parent branch nodechildren- the child node array- Returns:
- the new reordered array of children
-