Class GroupingExpression
java.lang.Object
com.yahoo.search.grouping.request.GroupingNode
com.yahoo.search.grouping.request.GroupingExpression
- Direct Known Subclasses:
AggregatorNode
,BucketValue
,ConstantValue
,DocumentValue
,FunctionNode
This class represents an expression in a
GroupingOperation
. You may manually construct this expression, or
you may use the GroupingParser
to generate one from a query-string.- Author:
- Simon Thoresen Hult
-
Constructor Summary
ModifierConstructorDescriptionprotected
GroupingExpression
(String image, String label, Integer level) -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Returns a string representation of an object that can be used in the 'image' constructor argument ofGroupingNode
.static String
asString
(List<GroupingExpression> lst) Returns a string description of the given list of expressions.abstract GroupingExpression
copy()
Returns a deep copy of thisint
getLevel()
Returns the conceptual level of this expression.protected final Integer
void
resolveLevel
(int level) Resolves the conceptual level of this expression.Assigns a label to this grouping expression.void
visit
(ExpressionVisitor visitor) Recursively callsExpressionVisitor.visitExpression(GroupingExpression)
for this expression and all of its argument expressions.Methods inherited from class com.yahoo.search.grouping.request.GroupingNode
getImage, getLabel, toString
-
Constructor Details
-
GroupingExpression
-
-
Method Details
-
copy
Returns a deep copy of this -
resolveLevel
public void resolveLevel(int level) Resolves the conceptual level of this expression. This level represents the type of data that is consumed by this expression, where level 0 is a single hit, level 1 is a group, level 2 is a list of groups, and so forth. This method verifies the input level against the expression type, and recursively resolves the level of all argument expressions.- Parameters:
level
- The level of the input data.- Throws:
IllegalArgumentException
- Thrown if the level of this expression could not be resolved.IllegalStateException
- Thrown if type failed to accept the number of arguments provided.
-
getLevel
public int getLevel()Returns the conceptual level of this expression.- Returns:
- the level.
- Throws:
IllegalArgumentException
- thrown if the level of this expression has not been resolved.- See Also:
-
getLevelOrNull
-
visit
Recursively callsExpressionVisitor.visitExpression(GroupingExpression)
for this expression and all of its argument expressions.- Parameters:
visitor
- The visitor to call.
-
asString
Returns a string description of the given list of expressions. This is a comma-separated list of the expressions ownGroupingNode.toString()
output.- Parameters:
lst
- The list of expressions to output.- Returns:
- The string description.
-
asImage
Returns a string representation of an object that can be used in the 'image' constructor argument ofGroupingNode
. This method ensures that strings are quoted, and that all complex characters are escaped.- Parameters:
obj
- The object to output.- Returns:
- The string representation.
-
setLabel
Description copied from class:GroupingNode
Assigns a label to this grouping expression. The label is applied to the results of this expression so that they can be identified by the caller when processing the output.- Overrides:
setLabel
in classGroupingNode
- Parameters:
label
- The label to assign to this.- Returns:
- This, to allow chaining.
-