|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.singularsys.jep.Operator
public class Operator
An Operator with additional information about its commutativity etc.
Operators have a number of properties:
Field Summary | |
---|---|
static int |
ASSOCIATIVE
Associative operators x*(y*z) == (x*y)*z . |
static int |
BINARY
Binary operators, such as x+y, x>y |
static int |
COMMUTATIVE
Commutative operators x*y = y*x. |
static int |
COMPOSITE
composite operators, like a-b which is a+(-b) |
static int |
EQUIVILENCE
Equivalence relations = reflexive, transitive and symmetric. |
int |
flags
flags for type of operator |
static int |
LEFT
Left binding like +: 1+2+3 -> (1+2)+3 |
static int |
NARY
Trinary ops such as ? |
static int |
NO_ARGS
No arguments to operator |
static int |
NOT_IN_PARSER
Non standard operators, like array access. |
static int |
PREFIX
prefix operators -x |
static int |
REFLEXIVE
Reflective relations x=x for all x. |
static int |
RIGHT
Right binding like =: 1=2=3 -> 1=(2=3) |
static int |
SELF_INVERSE
self inverse operators like -(-x) ! |
static int |
SUFFIX
postfix operators x% |
static int |
SYMMETRIC
Symmetric relation x=y implies y=x. |
static int |
TERNARY
three argument operators like java's cond? |
static int |
TRANSITIVE
Transitive relations x=y and y=z implies x=z |
static int |
UNARY
Unary operators, such as -x ! |
static int |
USE_BINDING_FOR_PRINT
For non commutative operators printing can be determined by the left or right binding. |
Constructor Summary | |
---|---|
Operator(java.lang.String name,
PostfixMathCommandI pfmc,
int flags)
construct a new operator. |
|
Operator(java.lang.String name,
PostfixMathCommandI pfmc,
int flags,
int precedence)
Allows a given precedent to be set. |
|
Operator(java.lang.String name,
java.lang.String symbol,
PostfixMathCommandI pfmc,
int flags)
construct a new operator, with a different name and symbol |
|
Operator(java.lang.String name,
java.lang.String symbol,
PostfixMathCommandI pfmc,
int flags,
int precedence)
Allows a given precedent to be set. |
Method Summary | |
---|---|
Operator |
getBinaryInverseOp()
|
int |
getBinding()
Deprecated. |
Operator |
getInverseOp()
|
int |
getKey()
Get the key code used to identify the operator in the operator table. |
java.lang.String |
getName()
returns a unique name defining this operator. |
PostfixMathCommandI |
getPFMC()
|
int |
getPrecedence()
Get the precedence of the operator. |
Operator |
getRootOp()
|
java.lang.String |
getSymbol()
returns the symbol used by this operator. |
boolean |
isAssociative()
|
boolean |
isBinary()
|
boolean |
isCommutative()
|
boolean |
isComposite()
|
boolean |
isDistributiveOver(Operator op)
|
boolean |
isEquivilence()
|
boolean |
isLeftBinding()
|
boolean |
isNary()
|
boolean |
isPrefix()
|
boolean |
isReflexive()
|
boolean |
isRightBinding()
|
boolean |
isSelfInverse()
|
boolean |
isSuffix()
|
boolean |
isSymmetric()
|
boolean |
isTernary()
|
boolean |
isTransitive()
|
boolean |
isUnary()
|
boolean |
notInParser()
|
int |
numArgs()
|
void |
setBinaryInverseOp(Operator inv)
|
void |
setDistributiveOver(Operator op)
|
void |
setInverseOp(Operator inv)
|
void |
setKey(int key)
Key code used to identify the operator in the operator table. |
void |
setPFMC(PostfixMathCommandI pfmc)
|
void |
setPrecedence(int i)
Set the precedence of the operator. |
void |
setRootOp(Operator root)
|
java.lang.String |
toFullString()
returns a verbose representation of the operator and all its properties. |
java.lang.String |
toString()
|
boolean |
useBindingForPrint()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int NO_ARGS
public static final int UNARY
public static final int BINARY
public static final int NARY
public static final int LEFT
public static final int RIGHT
public static final int ASSOCIATIVE
public static final int COMMUTATIVE
public static final int REFLEXIVE
public static final int SYMMETRIC
public static final int TRANSITIVE
public static final int EQUIVILENCE
public static final int PREFIX
public static final int SUFFIX
public static final int SELF_INVERSE
public static final int COMPOSITE
public static final int USE_BINDING_FOR_PRINT
public static final int NOT_IN_PARSER
public static final int TERNARY
TernaryOperator
,
Constant Field Valuespublic int flags
Constructor Detail |
---|
public Operator(java.lang.String name, PostfixMathCommandI pfmc, int flags)
name
- printable name of operatorpfmc
- postfix math command for operatorflags
- set of flags defining the properties of the operator.public Operator(java.lang.String name, PostfixMathCommandI pfmc, int flags, int precedence)
name
- pfmc
- flags
- precedence
- public Operator(java.lang.String name, java.lang.String symbol, PostfixMathCommandI pfmc, int flags)
name
- name of operator, must be unique, used when describing operatorsymbol
- printable name of operator, used for printing equationspfmc
- postfix math command for operatorpublic Operator(java.lang.String name, java.lang.String symbol, PostfixMathCommandI pfmc, int flags, int precedence)
name
- pfmc
- flags
- precedence
- Method Detail |
---|
public final java.lang.String getSymbol()
public final java.lang.String getName()
public final PostfixMathCommandI getPFMC()
public final void setPFMC(PostfixMathCommandI pfmc)
public final int getPrecedence()
public final void setPrecedence(int i)
public final void setDistributiveOver(Operator op)
public boolean isDistributiveOver(Operator op)
public void setRootOp(Operator root)
public void setInverseOp(Operator inv)
public void setBinaryInverseOp(Operator inv)
public Operator getRootOp()
public Operator getInverseOp()
public Operator getBinaryInverseOp()
@Deprecated public final int getBinding()
isLeftBinding()
,
isRightBinding()
public final boolean isLeftBinding()
public final boolean isRightBinding()
public final boolean isAssociative()
public final boolean isCommutative()
public final boolean isBinary()
public final boolean isUnary()
public final boolean isNary()
public final int numArgs()
public final boolean isTransitive()
public final boolean isSymmetric()
public final boolean isReflexive()
public final boolean isEquivilence()
public final boolean isPrefix()
public final boolean isSuffix()
public final boolean isTernary()
public final boolean isComposite()
public final boolean isSelfInverse()
public final boolean useBindingForPrint()
public final boolean notInParser()
public java.lang.String toFullString()
public java.lang.String toString()
toString
in class java.lang.Object
public int getKey()
public void setKey(int key)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |