Class FunctionNode
- java.lang.Object
-
- com.yahoo.search.grouping.request.GroupingNode
-
- com.yahoo.search.grouping.request.GroupingExpression
-
- com.yahoo.search.grouping.request.FunctionNode
-
- All Implemented Interfaces:
Iterable<GroupingExpression>
- Direct Known Subclasses:
AddFunction
,AndFunction
,AvgFunction
,CatFunction
,DateFunction
,DayOfMonthFunction
,DayOfWeekFunction
,DayOfYearFunction
,DebugWaitFunction
,DivFunction
,FixedWidthFunction
,HourOfDayFunction
,MathACosFunction
,MathACosHFunction
,MathASinFunction
,MathASinHFunction
,MathATanFunction
,MathATanHFunction
,MathCbrtFunction
,MathCosFunction
,MathCosHFunction
,MathExpFunction
,MathFloorFunction
,MathHypotFunction
,MathLog10Function
,MathLog1pFunction
,MathLogFunction
,MathPowFunction
,MathSinFunction
,MathSinHFunction
,MathSqrtFunction
,MathTanFunction
,MathTanHFunction
,MaxFunction
,Md5Function
,MinFunction
,MinuteOfHourFunction
,ModFunction
,MonthOfYearFunction
,MulFunction
,NegFunction
,NormalizeSubjectFunction
,NowFunction
,OrFunction
,PredefinedFunction
,ReverseFunction
,SecondOfMinuteFunction
,SizeFunction
,SortFunction
,StrCatFunction
,StrLenFunction
,SubFunction
,ToDoubleFunction
,ToLongFunction
,ToRawFunction
,ToStringFunction
,UcaFunction
,XorBitFunction
,XorFunction
,YearFunction
,ZCurveXFunction
,ZCurveYFunction
public abstract class FunctionNode extends GroupingExpression implements Iterable<GroupingExpression>
This class represents a function in aGroupingExpression
. Because it operate on other expressions (as opposed toAggregatorNode
andDocumentValue
that operate on inputs), this expression type can be used at any input level (seeGroupingExpression.resolveLevel(int)
).- Author:
- Simon Thoresen Hult
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
FunctionNode(String image, String label, Integer level, List<GroupingExpression> args)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<GroupingExpression>
args()
Returns the arguments of this as a list which cannot be modifiedprotected static <T> List<T>
asList(List<T> foo, List<T> bar)
protected static <T> List<T>
asList(T arg1, T... argN)
protected static <T> List<T>
asList(T arg1, T arg2, T... argN)
GroupingExpression
getArg(int i)
Returns the argument at the given index.int
getNumArgs()
Returns the number of arguments that were given to this function at construction.Iterator<GroupingExpression>
iterator()
void
resolveLevel(int level)
Resolves the conceptual level of this 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.GroupingExpression
asImage, asString, copy, getLevel, getLevelOrNull, setLabel
-
Methods inherited from class com.yahoo.search.grouping.request.GroupingNode
getImage, getLabel, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
FunctionNode
protected FunctionNode(String image, String label, Integer level, List<GroupingExpression> args)
-
-
Method Detail
-
getNumArgs
public int getNumArgs()
Returns the number of arguments that were given to this function at construction.- Returns:
- The argument count.
-
getArg
public GroupingExpression getArg(int i)
Returns the argument at the given index.- Parameters:
i
- The index of the argument to return.- Returns:
- The argument at the given index.
- Throws:
IndexOutOfBoundsException
- If the index is out of range.
-
args
protected List<GroupingExpression> args()
Returns the arguments of this as a list which cannot be modified
-
iterator
public Iterator<GroupingExpression> iterator()
- Specified by:
iterator
in interfaceIterable<GroupingExpression>
-
resolveLevel
public void resolveLevel(int level)
Description copied from class:GroupingExpression
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.- Overrides:
resolveLevel
in classGroupingExpression
- Parameters:
level
- The level of the input data.
-
visit
public void visit(ExpressionVisitor visitor)
Description copied from class:GroupingExpression
Recursively callsExpressionVisitor.visitExpression(GroupingExpression)
for this expression and all of its argument expressions.- Overrides:
visit
in classGroupingExpression
- Parameters:
visitor
- The visitor to call.
-
asList
protected static <T> List<T> asList(T arg1, T... argN)
-
asList
protected static <T> List<T> asList(T arg1, T arg2, T... argN)
-
-