|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.singularsys.jep.OperatorTable2
public class OperatorTable2
An operator table where operators are identified by enums.
Nested Class Summary | |
---|---|
static class |
OperatorTable2.BasicOperators
The basic arithmetic comparative and logical operators |
static interface |
OperatorTable2.OperatorKey
All operators enums must implement this interface. |
static class |
OperatorTable2.PsudoOperators
Operators which do not correspond to |
static class |
OperatorTable2.SpecialOperators
Special purpose operators |
Constructor Summary | |
---|---|
OperatorTable2()
|
|
OperatorTable2(OperatorTable2 oldTable)
Decorator constructor. |
Method Summary | |
---|---|
Operator |
addOperator(OperatorTable2.OperatorKey key,
Operator op)
Add a operator with a given key. |
Operator |
addOperator(OperatorTable2.OperatorKey key,
Operator op,
Operator existingOp)
Add operator with the same precedence level as an existing operator. |
Operator |
appendOperator(OperatorTable2.OperatorKey key,
Operator op,
Operator existingOp)
Add an operator with a new precedence level which is lower than the existing op. |
java.util.Set<java.util.Map.Entry<OperatorTable2.OperatorKey,Operator>> |
entrySet()
|
Operator |
getAdd()
|
Operator |
getAnd()
|
Operator |
getAssign()
|
Operator |
getCross()
|
Operator |
getDivide()
|
Operator |
getDot()
|
Operator |
getEle()
|
Operator |
getEQ()
|
Operator |
getGE()
|
Operator |
getGT()
|
OperatorTable2.OperatorKey |
getKey(Operator op)
Gets the key associated with a specific operator |
Operator |
getLE()
|
JepComponent |
getLightWeightInstance()
Gets a light-weight instance suitable for using in multiple threads. |
Operator |
getList()
|
Operator |
getLT()
|
Operator |
getMod()
|
Operator |
getMultiply()
|
Operator |
getNE()
|
Operator |
getNop()
|
Operator |
getNot()
|
int |
getNumOps()
|
Operator |
getOperator(OperatorTable2.OperatorKey key)
Get operator by its key code. |
java.util.Collection<Operator> |
getOperators()
Return the full list of operators |
Operator |
getOperatorsByName(java.lang.String name)
Get the operator with a given name |
java.util.List<Operator> |
getOperatorsBySymbol(java.lang.String symbol)
Gets all the operators with a given symbol |
Operator |
getOr()
|
Operator |
getPower()
|
Operator |
getRange()
|
Operator |
getSubtract()
|
Operator |
getUDivide()
unary division i.e. 1/x or x^(-1) * |
Operator |
getUMinus()
|
Operator |
getUPlus()
|
void |
init(Jep jep)
Initialize the component. |
Operator |
insertOperator(OperatorTable2.OperatorKey key,
Operator op,
Operator existingOp)
Add operator with the same precedence level as an existing operator. |
java.util.Set<OperatorTable2.OperatorKey> |
keySet()
|
void |
removeOperator(Operator op)
Remove a give operator from the table |
void |
removeOperator(OperatorTable2.OperatorKey key)
Remove a give operator from the table |
void |
replaceOperator(Operator oldOp,
Operator op)
Replace a give operator with a new one. |
void |
replaceOperator(OperatorTable2.OperatorKey key,
Operator op)
Replace a give operator with a new one. |
protected boolean |
setBinaryInverseOp(OperatorTable2.OperatorKey key1,
OperatorTable2.OperatorKey key2)
|
protected boolean |
setDistributiveOver(OperatorTable2.OperatorKey key1,
OperatorTable2.OperatorKey key2)
|
protected boolean |
setInverseOp(OperatorTable2.OperatorKey key1,
OperatorTable2.OperatorKey key2)
|
boolean |
setPrecedenceTable(OperatorTable2.OperatorKey[][] precArray)
Sets the precedence of all operators at one time. |
protected boolean |
setRootOp(OperatorTable2.OperatorKey key1,
OperatorTable2.OperatorKey key2)
|
protected void |
setStandardOperatorRelations()
Sets up the standard relations between +,-,*,/ |
java.lang.String |
toString()
String rep operators ordered by precedence, one per line. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public OperatorTable2()
public OperatorTable2(OperatorTable2 oldTable)
oldTable
- Method Detail |
---|
public void init(Jep jep)
JepComponent
init
in interface JepComponent
jep
- the current Jep instancepublic int getNumOps()
public Operator addOperator(OperatorTable2.OperatorKey key, Operator op)
key
- integer key valueop
-
public Operator addOperator(OperatorTable2.OperatorKey key, Operator op, Operator existingOp)
key
- op
- existingOp
-
public Operator insertOperator(OperatorTable2.OperatorKey key, Operator op, Operator existingOp)
op
- existingOp
-
public Operator appendOperator(OperatorTable2.OperatorKey key, Operator op, Operator existingOp)
key
- op
- existingOp
-
public OperatorTable2.OperatorKey getKey(Operator op)
op
-
public void removeOperator(Operator op)
op
- public void removeOperator(OperatorTable2.OperatorKey key)
key
- public void replaceOperator(Operator oldOp, Operator op)
oldOp
- the operator to be replacedop
- the new operatorpublic void replaceOperator(OperatorTable2.OperatorKey key, Operator op)
key
- the key for the operatorop
- the new operatorpublic Operator getOperator(OperatorTable2.OperatorKey key)
key
- code used in the table
public java.util.List<Operator> getOperatorsBySymbol(java.lang.String symbol)
getOperatorsBySymbol
in interface OperatorTableI
symbol
- symbol used for operator
public Operator getOperatorsByName(java.lang.String name)
getOperatorsByName
in interface OperatorTableI
name
- unique name of operator
public java.util.Collection<Operator> getOperators()
getOperators
in interface OperatorTableI
public java.util.Set<java.util.Map.Entry<OperatorTable2.OperatorKey,Operator>> entrySet()
public java.util.Set<OperatorTable2.OperatorKey> keySet()
public final boolean setPrecedenceTable(OperatorTable2.OperatorKey[][] precArray)
setPrecedenceTable(new OperatorKey[][] { { POWER }, { NEG, UPLUS, NOT }, { MUL, DIV, MOD, DOT, CROSS }, { ADD, SU }, { LT, LE, GT, GE }, { EQ, NE }, { AND }, { OR }, { ASSIGN }, });
precArray
-
protected boolean setInverseOp(OperatorTable2.OperatorKey key1, OperatorTable2.OperatorKey key2)
protected boolean setBinaryInverseOp(OperatorTable2.OperatorKey key1, OperatorTable2.OperatorKey key2)
protected boolean setRootOp(OperatorTable2.OperatorKey key1, OperatorTable2.OperatorKey key2)
protected boolean setDistributiveOver(OperatorTable2.OperatorKey key1, OperatorTable2.OperatorKey key2)
protected void setStandardOperatorRelations()
public Operator getNop()
getNop
in interface OperatorTableI
public Operator getAdd()
getAdd
in interface OperatorTableI
public Operator getSubtract()
getSubtract
in interface OperatorTableI
public Operator getUMinus()
getUMinus
in interface OperatorTableI
public Operator getUPlus()
getUPlus
in interface OperatorTableI
public Operator getMultiply()
getMultiply
in interface OperatorTableI
public Operator getDivide()
getDivide
in interface OperatorTableI
public Operator getMod()
getMod
in interface OperatorTableI
public Operator getUDivide()
getUDivide
in interface OperatorTableI
public Operator getPower()
getPower
in interface OperatorTableI
public Operator getGT()
getGT
in interface OperatorTableI
public Operator getLT()
getLT
in interface OperatorTableI
public Operator getEQ()
getEQ
in interface OperatorTableI
public Operator getLE()
getLE
in interface OperatorTableI
public Operator getGE()
getGE
in interface OperatorTableI
public Operator getNE()
getNE
in interface OperatorTableI
public Operator getAnd()
getAnd
in interface OperatorTableI
public Operator getOr()
getOr
in interface OperatorTableI
public Operator getNot()
getNot
in interface OperatorTableI
public Operator getAssign()
getAssign
in interface OperatorTableI
public Operator getDot()
getDot
in interface OperatorTableI
public Operator getCross()
getCross
in interface OperatorTableI
public Operator getList()
getList
in interface OperatorTableI
public Operator getEle()
getEle
in interface OperatorTableI
public Operator getRange()
getRange
in interface OperatorTableI
public java.lang.String toString()
toString
in class java.lang.Object
public JepComponent getLightWeightInstance()
JepComponent
getLightWeightInstance
in interface JepComponent
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |