Interface OperatorIfc

    • Field Detail

      • OPERATOR_PRECEDENCE_OR

        static final int OPERATOR_PRECEDENCE_OR
        Or operator precedence: ||
        See Also:
        Constant Field Values
      • OPERATOR_PRECEDENCE_AND

        static final int OPERATOR_PRECEDENCE_AND
        And operator precedence: &&
        See Also:
        Constant Field Values
      • OPERATOR_PRECEDENCE_EQUALITY

        static final int OPERATOR_PRECEDENCE_EQUALITY
        Equality operators precedence: =, ==, !=, <>
        See Also:
        Constant Field Values
      • OPERATOR_PRECEDENCE_COMPARISON

        static final int OPERATOR_PRECEDENCE_COMPARISON
        Comparative operators precedence: <, >, <=, >=
        See Also:
        Constant Field Values
      • OPERATOR_PRECEDENCE_ADDITIVE

        static final int OPERATOR_PRECEDENCE_ADDITIVE
        Additive operators precedence: + and -
        See Also:
        Constant Field Values
      • OPERATOR_PRECEDENCE_MULTIPLICATIVE

        static final int OPERATOR_PRECEDENCE_MULTIPLICATIVE
        Multiplicative operators precedence: *, /, %
        See Also:
        Constant Field Values
      • OPERATOR_PRECEDENCE_POWER

        static final int OPERATOR_PRECEDENCE_POWER
        Power operator precedence: ^
        See Also:
        Constant Field Values
      • OPERATOR_PRECEDENCE_UNARY

        static final int OPERATOR_PRECEDENCE_UNARY
        Unary operators precedence: + and - as prefix
        See Also:
        Constant Field Values
      • OPERATOR_PRECEDENCE_POWER_HIGHER

        static final int OPERATOR_PRECEDENCE_POWER_HIGHER
        An optional higher power operator precedence, higher than the unary prefix, e.g. -2^2 equals to 4 or -4, depending on precedence configuration.
        See Also:
        Constant Field Values
    • Method Detail

      • getPrecedence

        int getPrecedence()
        Returns:
        The operator's precedence.
      • isLeftAssociative

        boolean isLeftAssociative()
        If operators with same precedence are evaluated from left to right.
        Returns:
        The associativity.
      • isPrefix

        boolean isPrefix()
        If it is a prefix operator.
        Returns:
        true if it is a prefix operator.
      • isPostfix

        boolean isPostfix()
        If it is a postfix operator.
        Returns:
        true if it is a postfix operator.
      • isInfix

        boolean isInfix()
        If it is an infix operator.
        Returns:
        true if it is an infix operator.
      • getPrecedence

        int getPrecedence​(ExpressionConfiguration configuration)
        Called during parsing, can be implemented to return a customized precedence.
        Parameters:
        configuration - The expression configuration.
        Returns:
        The default precedence from the operator annotation, or a customized value.
      • isOperandLazy

        boolean isOperandLazy()
        Checks if the operand is lazy.
        Returns:
        true if operands are defined as lazy.
      • evaluate

        EvaluationValue evaluate​(Expression expression,
                                 Token operatorToken,
                                 EvaluationValue... operands)
                          throws EvaluationException
        Performs the operator logic and returns an evaluation result.
        Parameters:
        expression - The expression, where this function is executed. Can be used to access the expression configuration.
        operatorToken - The operator token from the parsed expression.
        operands - The operands, one for prefix and postfix operators, two for infix operators.
        Returns:
        The evaluation result in form of a EvaluationValue.
        Throws:
        EvaluationException - In case there were problems during evaluation.