Class AbstractLazyOperator

  • All Implemented Interfaces:
    LazyOperator
    Direct Known Subclasses:
    AbstractOperator

    public abstract class AbstractLazyOperator
    extends java.lang.Object
    implements LazyOperator
    Abstract implementation of an operator.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected boolean booleanOperator
      Operator is boolean.
      protected boolean leftAssoc
      Operator is left associative.
      protected java.lang.String oper
      This operators name (pattern).
      protected int precedence
      Operators precedence.
      protected boolean unaryOperator
      Operator is unary, i.e.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected AbstractLazyOperator​(java.lang.String oper, int precedence, boolean leftAssoc)
      Creates a new operator.
      protected AbstractLazyOperator​(java.lang.String oper, int precedence, boolean leftAssoc, boolean booleanOperator)
      Creates a new boolean operator.
      protected AbstractLazyOperator​(java.lang.String oper, int precedence, boolean leftAssoc, boolean booleanOperator, boolean unaryOperator)
      Creates a new unary operator.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getOper()
      Gets the String that is used to denote the operator in the expression.
      int getPrecedence()
      Gets the precedence value of this operator.
      boolean isBooleanOperator()
      Gets whether this operator evaluates to a boolean expression.
      boolean isLeftAssoc()
      Gets whether this operator is left associative (true) or if this operator is right associative (false).
      boolean isUnaryOperator()
      Gets whether this operator is unary or not.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • oper

        protected java.lang.String oper
        This operators name (pattern).
      • precedence

        protected int precedence
        Operators precedence.
      • leftAssoc

        protected boolean leftAssoc
        Operator is left associative.
      • booleanOperator

        protected boolean booleanOperator
        Operator is boolean.
      • unaryOperator

        protected boolean unaryOperator
        Operator is unary, i.e. 1 or 2 operands expected for this operator.
    • Constructor Detail

      • AbstractLazyOperator

        protected AbstractLazyOperator​(java.lang.String oper,
                                       int precedence,
                                       boolean leftAssoc,
                                       boolean booleanOperator,
                                       boolean unaryOperator)
        Creates a new unary operator. This constructor allows the use of postfix unary operators.
        Parameters:
        oper - The operator name (pattern).
        precedence - The operators precedence.
        leftAssoc - true if the operator is left associative, else false.
        booleanOperator - Whether this operator is boolean.
        unaryOperator - true if the expected number of operands is 1, false if the expected number of operands is 2.
      • AbstractLazyOperator

        protected AbstractLazyOperator​(java.lang.String oper,
                                       int precedence,
                                       boolean leftAssoc,
                                       boolean booleanOperator)
        Creates a new boolean operator.
        Parameters:
        oper - The operator name (pattern).
        precedence - The operators precedence.
        leftAssoc - true if the operator is left associative, else false.
        booleanOperator - Whether this operator is boolean.
      • AbstractLazyOperator

        protected AbstractLazyOperator​(java.lang.String oper,
                                       int precedence,
                                       boolean leftAssoc)
        Creates a new operator.
        Parameters:
        oper - The operator name (pattern).
        precedence - The operators precedence.
        leftAssoc - true if the operator is left associative, else false.
    • Method Detail

      • getOper

        public java.lang.String getOper()
        Description copied from interface: LazyOperator
        Gets the String that is used to denote the operator in the expression.
        Specified by:
        getOper in interface LazyOperator
        Returns:
        The String that is used to denote the operator in the expression.
      • getPrecedence

        public int getPrecedence()
        Description copied from interface: LazyOperator
        Gets the precedence value of this operator.
        Specified by:
        getPrecedence in interface LazyOperator
        Returns:
        the precedence value of this operator.
      • isLeftAssoc

        public boolean isLeftAssoc()
        Description copied from interface: LazyOperator
        Gets whether this operator is left associative (true) or if this operator is right associative (false).
        Specified by:
        isLeftAssoc in interface LazyOperator
        Returns:
        true if this operator is left associative.
      • isBooleanOperator

        public boolean isBooleanOperator()
        Description copied from interface: LazyOperator
        Gets whether this operator evaluates to a boolean expression.
        Specified by:
        isBooleanOperator in interface LazyOperator
        Returns:
        true if this operator evaluates to a boolean expression.
      • isUnaryOperator

        public boolean isUnaryOperator()
        Description copied from interface: LazyOperator
        Gets whether this operator is unary or not.
        Specified by:
        isUnaryOperator in interface LazyOperator
        Returns:
        true if the number of operands for this operator is 1, or false if the number of operands is 2.