Class LambdaOperatorTable
java.lang.Object
com.singularsys.jep.EmptyOperatorTable
com.singularsys.jep.OperatorTable2
com.singularsys.jep.standard.StandardOperatorTable2
com.singularsys.extensions.lambda.LambdaOperatorTable
- All Implemented Interfaces:
JepComponent,OperatorTableI,Serializable
- Direct Known Subclasses:
ChainedOperatorTable
An OperatorTable that defines
the lambda definition operator
x => x^2,
the optional range operator [1..5],
the optinal send to operator x^2 -> y,
and optional ternary operator code ? x : y.
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:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumKeys to identify the lambda operators.Nested classes/interfaces inherited from class com.singularsys.jep.OperatorTable2
OperatorTable2.BasicOperators, OperatorTable2.PsudoOperators, OperatorTable2.SpecialOperatorsNested classes/interfaces inherited from class com.singularsys.jep.EmptyOperatorTable
EmptyOperatorTable.OperatorKey -
Constructor Summary
ConstructorsModifierConstructorDescriptionLambdaOperatorTable(OperatorTable2 oldTable, String lambdaDefSymbol, String rangeSymbol, String sendToSymbol, boolean hasTernary) A decorator constructor.LambdaOperatorTable(OperatorTable2 oldTable, String lambdaDefSymbol, String rangeSymbol, String sendToSymbol, boolean hasTernary, FieldI field) A decorator constructor with a specified field.LambdaOperatorTable(String lambdaDefSymbol, String rangeSymbol, String sendToSymbol, boolean hasTernary) Constructor with specified symbols.LambdaOperatorTable(String lambdaDefSymbol, String rangeSymbol, String sendToSymbol, boolean hasTernary, FieldI field) Constructor with specified symbols using a given field.protected -
Method Summary
Modifier and TypeMethodDescriptionprotected voidOverride to prevent the pfmc being changed in decorator constructor.protected voidOverride to prevent the pfmc being changed in decorator constructor.protected voidOverride to prevent the pfmc being changed in decorator constructor.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, getUPlusMethods 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
-
Constructor Details
-
LambdaOperatorTable
public LambdaOperatorTable(String lambdaDefSymbol, String rangeSymbol, String sendToSymbol, boolean hasTernary) Constructor with specified symbols. Defining the lambda definition operatorx => x^2the range operator[1..5]the send to operatorx^2 -> yand whether the ternary operatorcode ? x : yis 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 ? :"
-
LambdaOperatorTable
public LambdaOperatorTable(String lambdaDefSymbol, String rangeSymbol, String sendToSymbol, boolean hasTernary, FieldI field) Constructor with specified symbols using a given field. Defining the lambda definition operatorx => x^2the range operator[1..5]the send to operatorx^2 -> yand whether the ternary operatorcode ? x : yis 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 ? :"field- the field to use for the range operator. If null then a defaultLambdaRangeis used.
-
LambdaOperatorTable
public LambdaOperatorTable(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 ? :"
-
LambdaOperatorTable
-
LambdaOperatorTable
public LambdaOperatorTable(OperatorTable2 oldTable, String lambdaDefSymbol, String rangeSymbol, String sendToSymbol, boolean hasTernary, FieldI field) A decorator constructor with a specified field. 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 ? :"field- the field to use for the range operator. If null then a defaultLambdaRangeis used.
-
-
Method Details
-
shallowCopy
Description copied from class:EmptyOperatorTableCreate 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 beusing the@Override public OperatorTableI shallowCopy() { Map<OperatorKey, Operator> map = this.threadSafeMapCopy(); return new MyOperatorTable(map); }EmptyOperatorTable.threadSafeMapCopy()method to return a copy of the map of operators and a constructor taking this map which uses theEmptyOperatorTable(Map)constructor.- Specified by:
shallowCopyin interfaceOperatorTableI- Overrides:
shallowCopyin classStandardOperatorTable2- Returns:
- a new Table
-
setBasicPfmcs
protected void setBasicPfmcs()Override to prevent the pfmc being changed in decorator constructor.- Overrides:
setBasicPfmcsin classStandardOperatorTable2- See Also:
-
setSpecialPfmcs
protected void setSpecialPfmcs()Override to prevent the pfmc being changed in decorator constructor.- Overrides:
setSpecialPfmcsin classStandardOperatorTable2- See Also:
-
setPsudoPfmcs
protected void setPsudoPfmcs()Override to prevent the pfmc being changed in decorator constructor.- Overrides:
setPsudoPfmcsin classStandardOperatorTable2
-
getLambdaDef
-
getSendTo
-
getTernary
-