Class JavaOperatorTable

  • All Implemented Interfaces:
    JepComponent, OperatorTableI, java.io.Serializable

    public class JavaOperatorTable
    extends BitwiseOperatorTable

    An operator table which supports most of the operators which appear in Java. Includes ++x, x++, a?b:c, x+=y etc. and bitwise operators.

    The full set added is: a&b, a|b, ~a, a^b, a>>b, a<<b a<<<b, x?y:z, ++x, --x, x++, x--, x+=y, x-=y, x*=y, x/=y, x%=y, x&=y, x|=y, x^=y, x<<=y, x>>=y, x<<<=y.

    Author:
    Richard Morris
    See Also:
    Serialized Form
    • Constructor Detail

      • JavaOperatorTable

        public JavaOperatorTable()
        A JavaOperatorTable with power represented as ** and xor as ^.
      • JavaOperatorTable

        public JavaOperatorTable​(java.lang.String powerSymbol)
        A JavaOperatorTable with xor represented as ^ and power as the argument.
        Parameters:
        powerSymbol - sequence used to represent power.
      • JavaOperatorTable

        public JavaOperatorTable​(java.lang.String powerSymbol,
                                 java.lang.String xorSymbol)
        A JavaOperatorTable with power and xor represented by the arguments
        Parameters:
        powerSymbol - string used to represent power.
        xorSymbol - string used to represent xor.
      • JavaOperatorTable

        public JavaOperatorTable​(OperatorTable2 oldTable,
                                 java.lang.String powerSymbol,
                                 java.lang.String xorSymbol)
        A decerator constructor. Takes all the operators suplied in the oldTable and add extra bitwise and java operations.
        Parameters:
        oldTable - table with most operators.
        powerSymbol - string used to represent power.
        xorSymbol - string used to represent xor.
    • Method Detail

      • addJavaOps

        protected void addJavaOps()
      • setJavaPfmcs

        protected void setJavaPfmcs()
      • getPreInc

        public Operator getPreInc()
      • getPreDec

        public Operator getPreDec()
      • getPostInc

        public Operator getPostInc()
      • getPostDec

        public Operator getPostDec()
      • getPlusEquals

        public Operator getPlusEquals()
      • getMinusEquals

        public Operator getMinusEquals()
      • getTimesEquals

        public Operator getTimesEquals()
      • getDivideEquals

        public Operator getDivideEquals()
      • getModEquals

        public Operator getModEquals()
      • getAndEquals

        public Operator getAndEquals()
      • getOrEquals

        public Operator getOrEquals()
      • getXOrEquals

        public Operator getXOrEquals()
      • getLShiftEquals

        public Operator getLShiftEquals()
      • getRShiftEquals

        public Operator getRShiftEquals()
      • getURShiftEquals

        public Operator getURShiftEquals()
      • shallowCopy

        public OperatorTableI shallowCopy()
        Description copied from class: EmptyOperatorTable
        Create a new version of this OperatorTable. Operators are copied into new table. However Operators whose pfmc implement JepComponent are duplicated. This means the table could be used in a separate thread without problem. Subclasses should override with method to return a table of the correct type, a typical implementation would be
            @Override
            public OperatorTableI shallowCopy() {
                Map<OperatorKey, Operator> map = this.threadSafeMapCopy();
                return new MyOperatorTable(map);
            }
         
        using the EmptyOperatorTable.threadSafeMapCopy() method to return a copy of the map of operators and a constructor taking this map which uses the EmptyOperatorTable(Map) constructor.
        Specified by:
        shallowCopy in interface OperatorTableI
        Overrides:
        shallowCopy in class BitwiseOperatorTable
        Returns:
        a new Table