Class AbstractModularStandardOperationProcessor

  • All Implemented Interfaces:
    StandardOperationProcessor
    Direct Known Subclasses:
    DefaultModularStandardOperationProcessor

    public abstract class AbstractModularStandardOperationProcessor
    extends java.lang.Object
    implements StandardOperationProcessor
    Abstract base implementation for a modular processor processing standard operations. This processor builds a kind of abstract syntax tree for evaluation of operations.
    Author:
    Rene Schneider - initial API and implementation
    • Constructor Detail

      • AbstractModularStandardOperationProcessor

        public AbstractModularStandardOperationProcessor()
        Creates an instance.
    • Method Detail

      • addOperatorInfo

        protected void addOperatorInfo​(java.lang.String anOperator,
                                       java.lang.Class<? extends OperatorNode<?,​?>> aNodeClass)
        Adds an operator.
        Parameters:
        anOperator - the operator string
        aNodeClass - the node class representing this operator
      • parseOperation

        protected OperatorNode<?,​?> parseOperation​(StandardOperation anOperation)
                                                  throws java.lang.SecurityException,
                                                         java.lang.IllegalArgumentException,
                                                         java.lang.NoSuchMethodException,
                                                         java.lang.InstantiationException,
                                                         java.lang.IllegalAccessException,
                                                         java.lang.reflect.InvocationTargetException
        Parses the given operation.
        Parameters:
        anOperation - the operation to parse
        Returns:
        the AST representing the operation
        Throws:
        java.lang.SecurityException
        java.lang.IllegalArgumentException
        java.lang.NoSuchMethodException
        java.lang.InstantiationException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException
      • getOperatorPrecedence

        protected int getOperatorPrecedence​(java.lang.String anOperator)
        Determines the precedence (ordering) of the given operator.
        Parameters:
        anOperator - the operator to evaluate
        Returns:
        the numeric precedence (higher = evaluate first)
      • createNode

        protected OperatorNode<?,​?> createNode​(Operation anOperation,
                                                     java.lang.String anOperator,
                                                     java.lang.Object aLeftOperand,
                                                     java.lang.Object aRightOperand)
                                              throws java.lang.SecurityException,
                                                     java.lang.NoSuchMethodException,
                                                     java.lang.IllegalArgumentException,
                                                     java.lang.InstantiationException,
                                                     java.lang.IllegalAccessException,
                                                     java.lang.reflect.InvocationTargetException
        Creates a new node.
        Parameters:
        anOperator - the operator
        aLeftOperand - the left operand (not evaluated)
        aRightOperand - the right operand (not evaluated)
        Returns:
        the node
        Throws:
        java.lang.SecurityException
        java.lang.NoSuchMethodException
        java.lang.IllegalArgumentException
        java.lang.InstantiationException
        java.lang.IllegalAccessException
        java.lang.reflect.InvocationTargetException