|
|||||||||
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 o |
protected int |
numOps
|
static int |
OP_ADD
|
static int |
OP_AND
|
static int |
OP_ASSIGN
|
static int |
OP_CROSS
|
static int |
OP_DIVIDE
|
static int |
OP_DOT
|
static int |
OP_ELEMENT
|
static int |
OP_EQ
|
static int |
OP_GE
|
static int |
OP_GT
|
static int |
OP_LE
|
static int |
OP_LIST
|
static int |
OP_LT
|
static int |
OP_MOD
|
static int |
OP_MULTIPLY
|
static int |
OP_NE
|
static int |
OP_NEGATE
|
static int |
OP_NOP
|
static int |
OP_NOT
|
static int |
OP_OR
|
static int |
OP_POWER
|
static int |
OP_RANGE
|
static int |
OP_RECIP
unary division i.e. 1/x or x^(-1) * |
static int |
OP_SUBTRACT
|
static int |
OP_UPLUS
|
protected Operator[] |
ops
|
Constructor Summary | |
---|---|
OperatorTable()
|
Method Summary | |
---|---|
Operator |
addOperator(int key,
Operator op)
|
Operator |
addOperator(int key,
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 |
getAdd()
|
Operator |
getAnd()
|
Operator |
getAssign()
|
Operator |
getCross()
|
Operator |
getDivide()
|
Operator |
getDot()
|
Operator |
getEle()
|
Operator |
getEQ()
|
Operator |
getGE()
|
Operator |
getGT()
|
Operator |
getLE()
|
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 which a new precedence level which is lower than the existing op |
void |
removeOperator(Operator op)
Remove an operator from the table. |
protected boolean |
setBinaryInverseOp(int key1,
int key2)
|
protected boolean |
setDistributiveOver(int key1,
int key2)
|
protected boolean |
setInverseOp(int key1,
int key2)
Creates the operator set from a given set. |
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
public static final int OP_NOP
public static final int OP_ADD
public static final int OP_SUBTRACT
public static final int OP_NEGATE
public static final int OP_UPLUS
public static final int OP_MULTIPLY
public static final int OP_DIVIDE
public static final int OP_MOD
public static final int OP_RECIP
public static final int OP_POWER
public static final int OP_GT
public static final int OP_LT
public static final int OP_EQ
public static final int OP_LE
public static final int OP_GE
public static final int OP_NE
public static final int OP_AND
public static final int OP_OR
public static final int OP_NOT
public static final int OP_ASSIGN
public static final int OP_DOT
public static final int OP_CROSS
public static final int OP_LIST
public static final int OP_ELEMENT
public 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 JepComponent
jep
- the current Jep instancepublic void setNumOps(int size)
public int getNumOps()
public Operator addOperator(int key, Operator op)
public Operator addOperator(int key, Operator op, Operator existingOp)
key
- op
- existingOp
-
public Operator insertOperator(int key, Operator op, Operator existingOp)
key
- op
- existingOp
-
public Operator appendOperator(int key, Operator op, Operator existingOp)
key
- op
- existingOp
-
public void removeOperator(Operator op)
op
- public Operator getOperator(int key)
key
- code used in the table
public java.util.List<Operator> getOperatorsBySymbol(java.lang.String symbol)
symbol
- symbol used for operator
public Operator getOperatorsByName(java.lang.String name)
name
- unique name of operator
public java.util.Collection<Operator> getOperators()
public 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()
public Operator getAdd()
public Operator getSubtract()
public Operator getUMinus()
public Operator getUPlus()
public Operator getMultiply()
public Operator getDivide()
public Operator getMod()
public Operator getUDivide()
public Operator getPower()
public Operator getGT()
public Operator getLT()
public Operator getEQ()
public Operator getLE()
public Operator getGE()
public Operator getNE()
public Operator getAnd()
public Operator getOr()
public Operator getNot()
public Operator getAssign()
public Operator getDot()
public Operator getCross()
public Operator getList()
public Operator getEle()
public Operator getRange()
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |