Package com.yahoo.document.select.rule
Class LogicNode
java.lang.Object
com.yahoo.document.select.rule.LogicNode
- All Implemented Interfaces:
ExpressionNode
This class defines a logical expression of nodes. This implementation uses a stack to evaluate its content as to
avoid deep recursions when building the parse tree.
- Author:
- Simon Thoresen Hult
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Private class to store expression nodes in a stack. -
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Perform visitation of this node.add
(String operator, ExpressionNode node) Adds an (operator, node) pair to this expression.Evaluate the content of this node based on document object, and return that value.getBucketSet
(BucketIdFactory factory) Returns the set of bucket ids covered by this node.getItems()
toString()
-
Field Details
-
NOP
public static final int NOP- See Also:
-
OR
public static final int OR- See Also:
-
AND
public static final int AND- See Also:
-
-
Constructor Details
-
LogicNode
public LogicNode()Construct an empty logic expression.
-
-
Method Details
-
getItems
-
add
Adds an (operator, node) pair to this expression.- Parameters:
operator
- The operator that combines the previous with the node given.node
- The node to add to this.- Returns:
- This, to allow chaining.
-
getBucketSet
Description copied from interface:ExpressionNode
Returns the set of bucket ids covered by this node.- Specified by:
getBucketSet
in interfaceExpressionNode
- Parameters:
factory
- the factory used by the current application
-
evaluate
Description copied from interface:ExpressionNode
Evaluate the content of this node based on document object, and return that value.- Specified by:
evaluate
in interfaceExpressionNode
- Parameters:
context
- the document to evaluate over- Returns:
- the value of this
-
accept
Description copied from interface:ExpressionNode
Perform visitation of this node.- Specified by:
accept
in interfaceExpressionNode
- Parameters:
visitor
- the visitor that wishes to visit the node
-
toString
-