Interface IEvalContext<TData,​TConstant extends IConstant,​TOperator extends IOperator>

  • Type Parameters:
    TConstant - Type of the implementation for constant symbols.
    TOperator - Type of the implementation for operator symbols.
    TData - Type of the data being handled by this evaluator.

    public interface IEvalContext<TData,​TConstant extends IConstant,​TOperator extends IOperator>
    Context for evaluating an infix expression. Users may provide custom context with additional logic.
    Since:
    7.0.0
    Author:
    XIMA MEDIA GmbH
    • Method Detail

      • evalConstant

        TData evalConstant​(TConstant constant)
                    throws Exception
        Evaluates the given constant and returns the value of that constant.
        Parameters:
        constant - Constant to evaluate.
        Returns:
        The value of the constant.
        Throws:
        Exception - When the constant could not be evaluated for any reason. When this exception is thrown, it is wrapped in a InfixExpressionException which is then throw by the evaluator.
      • evalInfix

        TData evalInfix​(TOperator operator,
                        TData arg1,
                        TData arg2)
                 throws Exception
        Evaluates the given infix operator operating on the two given arguments.
        Parameters:
        operator - Operator to evaluate.
        arg1 - Argument to the left of the infix operator.
        arg2 - Argument to the right of the infix operator.
        Returns:
        The value resulting from an application of the given operator to the arguments.
        Throws:
        Exception - When the operator could not be evaluated for any reason. When this exception is thrown, it is wrapped in a InfixExpressionException which is then throw by the evaluator.
      • evalPostfix

        TData evalPostfix​(TOperator operator,
                          TData arg1)
                   throws Exception
        Evaluates the given postfix operator operating on the given argument.
        Parameters:
        operator - Operator to evaluate.
        arg1 - Argument to the left of the postfix operator.
        Returns:
        The value resulting from an application of the given operator to the argument.
        Throws:
        Exception - When the operator could not be evaluated for any reason. When this exception is thrown, it is wrapped in a InfixExpressionException which is then throw by the evaluator.
      • evalPrefix

        TData evalPrefix​(TOperator operator,
                         TData arg1)
                  throws Exception
        Evaluates the given prefix operator operating on the given argument.
        Parameters:
        operator - Operator to evaluate.
        arg1 - Argument to the right of the prefix operator.
        Returns:
        The value resulting from an application of the given operator to the argument.
        Throws:
        Exception - When the operator could not be evaluated for any reason. When this exception is thrown, it is wrapped in a InfixExpressionException which is then throw by the evaluator.
      • evalVariable

        TData evalVariable​(String name)
                    throws Exception
        Finds and returns the value of the variable with the given name.
        Parameters:
        name - Name of the variable.
        Returns:
        The value of the given variable, or null when no value is available.
        Throws:
        Exception