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 over GroupingExpression objects. To resolve an operation simply push operator-expression pairs onto it, before calling resolve() to retrieve the single corresponding grouping expression object.
Author:
Simon Thoresen Hult
  • Constructor Details

    • MathResolver

      public MathResolver()
  • Method Details

    • 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, call resolve() 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.
    • toString

      public String toString()
      Overrides:
      toString in class Object