Class MathResolver
- java.lang.Object
-
- com.yahoo.search.grouping.request.MathResolver
-
public class MathResolver extends Object
This is a helper class for resolving arithmetic operations overGroupingExpression
objects. To resolve an operation simply push operator-expression pairs onto it, before callingresolve()
to retrieve the single corresponding grouping expression object.- Author:
- Simon Thoresen Hult
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MathResolver.Type
-
Constructor Summary
Constructors Constructor Description MathResolver()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
push(MathResolver.Type type, GroupingExpression exp)
Pushes the given operator-expression pair onto this math resolver.GroupingExpression
resolve()
Converts the internal list of operator-expression pairs into a corresponding combined grouping expression.String
toString()
-
-
-
Method Detail
-
push
public void push(MathResolver.Type type, GroupingExpression exp)
Pushes the given operator-expression pair onto this math resolver. Once all pairs have been pushed using this method, callresolve()
to retrieve to combined grouping expression.- Parameters:
type
- The operator that appears before the expression being pushed.exp
- The expression to push.
-
resolve
public GroupingExpression resolve()
Converts the internal list of operator-expression pairs into a corresponding combined grouping expression. When this method returns there is no residue of the conversion, and this object can be reused.- Returns:
- The grouping expression corresponding to the pushed arithmetic operations.
-
-