Class StreamOperatorTable

All Implemented Interfaces:
JepComponent, OperatorTableI, Serializable

public class StreamOperatorTable extends ChainedOperatorTable
An OperatorTable for stream package. It defines the chaining operator . that allows chained syntax by overloads the dot operator [1..10] . sum() and extends the lambda operator table to define the lambda definition operator x => x^2, the optional range operator [1..5], the optinal send to operator x^2 -> y, the optional ternary operator code ? x : y. The range operator uses the StreamRange function to return a stream of all the items. The main symbols used are defined in the constructor, the symbols list brackets and ternary operators are set in the properties file.
Since:
Jep 4.1 extensions 2.2
See Also:
  • Constructor Details

    • StreamOperatorTable

      public StreamOperatorTable(String lambdaDefSymbol, String rangeSymbol, String sendToSymbol, boolean hasTernary)
      Constructor with specified symbols. Defining the lambda definition operator x => x^2 the range operator [1..5] the send to operator x^2 -> y and whether the ternary operator code ? x : y is defined. The symbols list brackets and ternary operators are set in the properties file.
      Parameters:
      lambdaDefSymbol - string used to represent lambda definition operator, typically =>.
      rangeSymbol - string used to represent range operator, typically ... If null then no range operator is added.
      sendToSymbol - string used to represent send to operator, typically ->. If null then no send to operator is added.
      hasTernary - if true then a ternary conditional operator is added with symbol "cond ? :"
    • StreamOperatorTable

      public StreamOperatorTable(String lambdaDefSymbol, String rangeSymbol, String sendToSymbol, boolean hasTernary, FieldI field)
      Constructor with specified symbols. Defining the lambda definition operator x => x^2 the range operator [1..5] the send to operator x^2 -> y and whether the ternary operator code ? x : y is defined. The symbols list brackets and ternary operators are set in the properties file.
      Parameters:
      lambdaDefSymbol - string used to represent lambda definition operator, typically =>.
      rangeSymbol - string used to represent range operator, typically ... If null then no range operator is added.
      sendToSymbol - string used to represent send to operator, typically ->. If null then no send to operator is added.
      hasTernary - if true then a ternary conditional operator is added with symbol "cond ? :"
    • StreamOperatorTable

      public StreamOperatorTable(OperatorTable2 oldTable, String lambdaDefSymbol, String rangeSymbol, String sendToSymbol, boolean hasTernary)
      A decorator constructor. Takes all the operators supplied in the oldTable and add extra bitwise operations.
      Parameters:
      oldTable - table with most operators.
      lambdaDefSymbol - string used to represent lambda definition operator, typically =>.
      rangeSymbol - string used to represent range operator, typically ... If null then no range operator is added.
      sendToSymbol - string used to represent send to operator, typically ->. If null then no send to operator is added.
      hasTernary - if true then a ternary conditional operator is added with symbol "cond ? :"
    • StreamOperatorTable

      public StreamOperatorTable(OperatorTable2 oldTable, String lambdaDefSymbol, String rangeSymbol, String sendToSymbol, boolean hasTernary, FieldI field)
      A decorator constructor. Takes all the operators supplied in the oldTable and add extra bitwise operations.
      Parameters:
      oldTable - table with most operators.
      lambdaDefSymbol - string used to represent lambda definition operator, typically =>.
      rangeSymbol - string used to represent range operator, typically ... If null then no range operator is added.
      sendToSymbol - string used to represent send to operator, typically ->. If null then no send to operator is added.
      hasTernary - if true then a ternary conditional operator is added with symbol "cond ? :"
    • StreamOperatorTable

      protected StreamOperatorTable(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 ChainedOperatorTable
      Returns:
      a new Table