|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.singularsys.jep.OperatorTable
public class OperatorTable
| Field Summary | |
|---|---|
protected static int |
baseNumOps
Number operators in this table. |
protected int |
numOps
|
protected static int |
OP_ADD
|
protected static int |
OP_AND
|
protected static int |
OP_ASSIGN
|
protected static int |
OP_CROSS
|
protected static int |
OP_DIVIDE
|
protected static int |
OP_DOT
|
protected static int |
OP_ELEMENT
|
protected static int |
OP_EQ
|
protected static int |
OP_GE
|
protected static int |
OP_GT
|
protected static int |
OP_LE
|
protected static int |
OP_LIST
|
protected static int |
OP_LT
|
protected static int |
OP_MOD
|
protected static int |
OP_MULTIPLY
|
protected static int |
OP_NE
|
protected static int |
OP_NEGATE
|
protected static int |
OP_NOP
|
protected static int |
OP_NOT
|
protected static int |
OP_OR
|
protected static int |
OP_POWER
|
protected static int |
OP_RANGE
|
protected static int |
OP_RECIP
unary division i.e. 1/x or x^(-1) * |
protected static int |
OP_SUBTRACT
|
protected static int |
OP_UPLUS
|
protected Operator[] |
ops
|
| Constructor Summary | |
|---|---|
OperatorTable()
|
|
| Method Summary | |
|---|---|
Operator |
addOperator(int key,
Operator op)
Add a operator with a given key. |
Operator |
addOperator(int key,
Operator op,
Operator existingOp)
Add operator with the same precedence level as an existing operator. |
Operator |
addOperator(Operator op)
Add a operator with no key specified. |
Operator |
addOperator(Operator op,
Operator existingOp)
Add operator with the same precedence level as an existing operator. |
Operator |
appendOperator(int key,
Operator op,
Operator existingOp)
Add an operator which a new precedence level which is higher than the existing op |
Operator |
appendOperator(Operator op,
Operator existingOp)
Add an operator which a new precedence level which is higher than the existing op |
Operator |
getAdd()
|
Operator |
getAnd()
|
Operator |
getAssign()
|
Operator |
getCross()
|
Operator |
getDivide()
|
Operator |
getDot()
|
Operator |
getEle()
|
Operator |
getEQ()
|
Operator |
getGE()
|
Operator |
getGT()
|
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(int key)
Get operator by its key code. |
java.util.Collection<Operator> |
getOperators()
|
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(int key,
Operator op,
Operator existingOp)
Add an operator with a new precedence level which is lower than the existing op. |
Operator |
insertOperator(Operator op,
Operator existingOp)
Add an operator which a new precedence level which is lower than the existing op |
void |
removeOperator(Operator op)
Remove an operator from the table. |
Operator |
replaceOperator(Operator oldOp,
Operator op)
replace an existing operator by a new one. |
protected boolean |
setBinaryInverseOp(int key1,
int key2)
|
protected boolean |
setDistributiveOver(int key1,
int key2)
|
protected boolean |
setInverseOp(int key1,
int key2)
|
protected void |
setNumOps(int size)
|
boolean |
setPrecedenceTable(int[][] precArray)
Sets the precedence of all operators at one time. |
protected boolean |
setRootOp(int key1,
int 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 |
| Field Detail |
|---|
protected Operator[] ops
protected static final int OP_NOP
protected static final int OP_ADD
protected static final int OP_SUBTRACT
protected static final int OP_NEGATE
protected static final int OP_UPLUS
protected static final int OP_MULTIPLY
protected static final int OP_DIVIDE
protected static final int OP_MOD
protected static final int OP_RECIP
protected static final int OP_POWER
protected static final int OP_GT
protected static final int OP_LT
protected static final int OP_EQ
protected static final int OP_LE
protected static final int OP_GE
protected static final int OP_NE
protected static final int OP_AND
protected static final int OP_OR
protected static final int OP_NOT
protected static final int OP_ASSIGN
protected static final int OP_DOT
protected static final int OP_CROSS
protected static final int OP_LIST
protected static final int OP_ELEMENT
protected static final int OP_RANGE
protected static final int baseNumOps
protected int numOps
| Constructor Detail |
|---|
public OperatorTable()
| Method Detail |
|---|
public void init(Jep jep)
JepComponent
init in interface JepComponentjep - the current Jep instanceprotected void setNumOps(int size)
public int getNumOps()
public Operator addOperator(int key,
Operator op)
key - integer key valueop -
public Operator addOperator(Operator op)
op -
public Operator addOperator(int key,
Operator op,
Operator existingOp)
key - op - existingOp -
public Operator addOperator(Operator op,
Operator existingOp)
op - existingOp -
public Operator insertOperator(int key,
Operator op,
Operator existingOp)
key - op - existingOp -
public Operator insertOperator(Operator op,
Operator existingOp)
op - existingOp -
public Operator appendOperator(int key,
Operator op,
Operator existingOp)
key - op - existingOp -
public Operator appendOperator(Operator op,
Operator existingOp)
op - existingOp -
public void removeOperator(Operator op)
op - the operator to be removed
public Operator replaceOperator(Operator oldOp,
Operator op)
oldOp - the old operatorop - the new operator
public Operator getOperator(int key)
key - code used in the table
public java.util.List<Operator> getOperatorsBySymbol(java.lang.String symbol)
getOperatorsBySymbol in interface OperatorTableIsymbol - symbol used for operator
public Operator getOperatorsByName(java.lang.String name)
getOperatorsByName in interface OperatorTableIname - unique name of operator
public java.util.Collection<Operator> getOperators()
getOperators in interface OperatorTableIpublic final boolean setPrecedenceTable(int[][] precArray)
setPrecedenceTable(new int[][] { { OP_NEGATE, OP_UPLUS, OP_NOT }, { OP_POWER },
{ OP_MULTIPLY, OP_DIVIDE, OP_MOD, OP_DOT, OP_CROSS },
{ OP_ADD, OP_SUBTRACT }, { OP_LT, OP_LE, OP_GT, OP_GE },
{ OP_EQ, OP_NE }, { OP_AND }, { OP_OR }, { OP_ASSIGN },
});
precArray -
protected boolean setInverseOp(int key1,
int key2)
protected boolean setBinaryInverseOp(int key1,
int key2)
protected boolean setRootOp(int key1,
int key2)
protected boolean setDistributiveOver(int key1,
int key2)
protected void setStandardOperatorRelations()
public Operator getNop()
getNop in interface OperatorTableIpublic Operator getAdd()
getAdd in interface OperatorTableIpublic Operator getSubtract()
getSubtract in interface OperatorTableIpublic Operator getUMinus()
getUMinus in interface OperatorTableIpublic Operator getUPlus()
getUPlus in interface OperatorTableIpublic Operator getMultiply()
getMultiply in interface OperatorTableIpublic Operator getDivide()
getDivide in interface OperatorTableIpublic Operator getMod()
getMod in interface OperatorTableIpublic Operator getUDivide()
getUDivide in interface OperatorTableIpublic Operator getPower()
getPower in interface OperatorTableIpublic Operator getGT()
getGT in interface OperatorTableIpublic Operator getLT()
getLT in interface OperatorTableIpublic Operator getEQ()
getEQ in interface OperatorTableIpublic Operator getLE()
getLE in interface OperatorTableIpublic Operator getGE()
getGE in interface OperatorTableIpublic Operator getNE()
getNE in interface OperatorTableIpublic Operator getAnd()
getAnd in interface OperatorTableIpublic Operator getOr()
getOr in interface OperatorTableIpublic Operator getNot()
getNot in interface OperatorTableIpublic Operator getAssign()
getAssign in interface OperatorTableIpublic Operator getDot()
getDot in interface OperatorTableIpublic Operator getCross()
getCross in interface OperatorTableIpublic Operator getList()
getList in interface OperatorTableIpublic Operator getEle()
getEle in interface OperatorTableIpublic Operator getRange()
getRange in interface OperatorTableIpublic java.lang.String toString()
toString in class java.lang.Objectpublic JepComponent getLightWeightInstance()
JepComponent
getLightWeightInstance in interface JepComponent
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||