Package com.singularsys.jep.misc.bitwise
Class BitwiseOperatorTable
java.lang.Object
com.singularsys.jep.EmptyOperatorTable
com.singularsys.jep.OperatorTable2
com.singularsys.jep.standard.StandardOperatorTable2
com.singularsys.jep.misc.bitwise.BitwiseOperatorTable
- All Implemented Interfaces:
JepComponent
,OperatorTableI
,Serializable
- Direct Known Subclasses:
JavaOperatorTable
An operator table with a selection of bitwise operators.
- And: a & b
- Or: a | b
- Complement: ~a
- Xor: a ^ b
- Left shift: a >> b
- Right shift: a << b
- Right shift with zero extension: a <<< b
The BitwiseOperatorTable can be used as a drop in replacement for the StandardOperatorTable.
jep.setComponent(new BitwiseOperatorTable("**","^"));
Note the standard symbol used for power ^ conflicts with java's symbol used for xor, the constructor for the BitwiseOperatorTable takes two strings specifying the symbols used for power and xor respectively.
- Author:
- Richard Morris
- See Also:
-
Nested Class Summary
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
-
Constructor Summary
ModifierConstructorDescriptionBitwiseOperatorTable
(OperatorTable2 oldTable, String powerSymbol, String xorSymbol) A decorator constructor.BitwiseOperatorTable
(String powerSymbol, String xorSymbol) Standard constructor.protected
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
addBitOperators
(String powerSymbol, String xorSymbol) getBitOr()
protected void
A do nothing implementation.protected void
protected void
A do nothing implementation.protected void
A do nothing implementation.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, getKey, getLightWeightInstance, getNumOps, getOperator, getOperatorMap, getOperators, getOperatorsByName, getOperatorsBySymbol, init, insertOperator, insertOperator, keySet, removeOperator, removeOperator, replaceOperator, replaceOperator, setBinaryInverseOp, setDistributiveOver, setGroupOperatorRelations, setGroupOperatorRelations, setInverseOp, setPrecedenceTable, setRootOp, setStandardOperatorRelations, threadSafeMapCopy, toString
-
Constructor Details
-
BitwiseOperatorTable
Standard constructor.- Parameters:
powerSymbol
- string used to represent power.xorSymbol
- string used to represent xor.
-
BitwiseOperatorTable
A decorator constructor. Takes all the operators supplied in the oldTable and add extra bitwise operations.- Parameters:
oldTable
- table with most operators.powerSymbol
- string used to represent power.xorSymbol
- string used to represent xor.
-
BitwiseOperatorTable
-
-
Method Details
-
setBasicPfmcs
protected void setBasicPfmcs()A do nothing implementation.- Overrides:
setBasicPfmcs
in classStandardOperatorTable2
- See Also:
-
setSpecialPfmcs
protected void setSpecialPfmcs()A do nothing implementation.- Overrides:
setSpecialPfmcs
in classStandardOperatorTable2
- See Also:
-
setPsudoPfmcs
protected void setPsudoPfmcs()A do nothing implementation.- Overrides:
setPsudoPfmcs
in classStandardOperatorTable2
-
addBitOperators
-
setBitPfmcs
protected void setBitPfmcs() -
getBitAnd
-
getBitOr
-
getBitXor
-
getBitComp
-
getLShift
-
getRShift
-
getURShift
-
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 theEmptyOperatorTable.threadSafeMapCopy()
method to return a copy of the map of operators and a constructor taking this map which uses theEmptyOperatorTable(Map)
constructor.- Specified by:
shallowCopy
in interfaceOperatorTableI
- Overrides:
shallowCopy
in classStandardOperatorTable2
- Returns:
- a new Table
-