Package com.singularsys.jep.misc.nullwrapper

# Class NullWrappedOperatorTable

java.lang.Object
com.singularsys.jep.EmptyOperatorTable
com.singularsys.jep.OperatorTable2
com.singularsys.jep.misc.nullwrapper.NullWrappedOperatorTable

All Implemented Interfaces:
  `JepComponent`, `OperatorTableI`, `Serializable`

public class NullWrappedOperatorTable extends OperatorTable2
An operator table where the operators generally return null if either argument is null. The table can optionally add a null-safe equals operator `<=>` which acts like equals but returns 1 if both arguments are null.

Since:
  3.4
Author:
  Richard Morris
See Also:
  - `NullSafeEquals`
  - Serialized Form

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static enum`
  `NullWrappedOperatorTable.NullWrapperOperators`
  Key for the one operator NullSafeEquals added by the table.

  ## Nested classes/interfaces inherited from class com.singularsys.jep.OperatorTable2

  `OperatorTable2.BasicOperators, OperatorTable2.PsudoOperators, OperatorTable2.SpecialOperators`

  ## Nested classes/interfaces inherited from class com.singularsys.jep.EmptyOperatorTable

  `EmptyOperatorTable.OperatorKey`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected NullWrappedFunctionFactory`
  `factory`
  `protected boolean`
  `hasNullSafeEquals`
  `protected OperatorTable2`
  `root`

- ## Constructor Summary

  Constructors
  Modifier
  Constructor
  Description
  ``
  `NullWrappedOperatorTable(OperatorTable2 root, boolean hasNullSafeEquals)`
  Create a new operator table which wraps all the existing operators in the original table.
  ``
  `NullWrappedOperatorTable(OperatorTable2 root, NullWrappedFunctionFactory factory, boolean hasNullSafeEquals)`
  A table where a specific NullWrapperFunctionFactory is defined.
  `protected`
  `NullWrappedOperatorTable(Map<EmptyOperatorTable.OperatorKey,Operator> map)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `OperatorTableI`
  `shallowCopy()`
  Create a new version of this OperatorTable.

  ### Methods inherited from class com.singularsys.jep.OperatorTable2

  `getAdd, getAnd, getAssign, getCross, getDivide, getDot, getEle, getEQ, getGE, getGT, getLE, getList, getLT, getMod, getMultiply, getNE, getNop, getNot, getOr, getPower, getRange, getSubtract, getUDivide, getUMinus, getUPlus`

  ### Methods inherited from class com.singularsys.jep.EmptyOperatorTable

  `addOperator, addOperator, addOperator, appendOperator, appendOperator, entrySet, getAllOperatorsByName, getKey, getKeys, getLightWeightInstance, getNumOps, getOperator, getOperatorByName, getOperatorMap, getOperators, getOperatorsByName, getOperatorsBySymbol, init, insertOperator, insertOperator, keySet, removeOperator, removeOperator, replaceOperator, replaceOperator, setBinaryInverseOp, setDistributiveOver, setGroupOperatorRelations, setGroupOperatorRelations, setInverseOp, setPrecedenceTable, setRootOp, setStandardOperatorRelations, threadSafeMapCopy, toString`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### root

    protected OperatorTable2 root

  - ### factory

    protected NullWrappedFunctionFactory factory

  - ### hasNullSafeEquals

    protected boolean hasNullSafeEquals

- ## Constructor Details

  - ### NullWrappedOperatorTable

    public NullWrappedOperatorTable(OperatorTable2 root, boolean hasNullSafeEquals)
    Create a new operator table which wraps all the existing operators in the original table. Calls `NullWrappedFunctionFactory.getWrappedFunction(PostfixMathCommandI)` to find the appropriate PFMC for each operator.
    Parameters:
      `root` - the original operator table
      `hasNullSafeEquals` - if true adds a NullSafeEquals operator "<=>" to the table

  - ### NullWrappedOperatorTable

    public NullWrappedOperatorTable(OperatorTable2 root, NullWrappedFunctionFactory factory, boolean hasNullSafeEquals)
    A table where a specific NullWrapperFunctionFactory is defined.
    Parameters:
      `root` -
      `factory` -
      `hasNullSafeEquals` -
    Since:
      Jep 3.5

  - ### NullWrappedOperatorTable

    protected NullWrappedOperatorTable(Map<EmptyOperatorTable.OperatorKey,Operator> map)

- ## Method Details

  - ### 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 `OperatorTable2`
    Returns:
      a new Table