|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.nfunk.jep.Operator org.lsmp.djep.xjep.XOperator
public class XOperator
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
Equivilence relations = reflexive, transative and symetric. |
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 |
PREFIX
prefix operators -x |
static int |
REFLEXIVE
Reflecive 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 |
SUFIX
postfix operators x%, if neiter prefix and postif then infix, if both trifix like x? |
static int |
SYMMETRIC
Symmetric relation x=y implies y=x. |
static int |
TRANSITIVE
Transative 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 | |
---|---|
XOperator(Operator op,
int flags)
|
|
XOperator(Operator op,
int flags,
int precedence)
|
|
XOperator(java.lang.String name,
PostfixMathCommandI pfmc,
int flags)
construct a new operator. |
|
XOperator(java.lang.String name,
PostfixMathCommandI pfmc,
int flags,
int precedence)
Allows a given precedent to be set. |
|
XOperator(java.lang.String name,
java.lang.String symbol,
PostfixMathCommandI pfmc,
int flags)
construct a new operator, with a different name and symbol |
|
XOperator(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()
When parsing how is x+y+z interpreted. |
Operator |
getInverseOp()
|
int |
getPrecedence()
|
Operator |
getRootOp()
|
boolean |
isAssociative()
|
boolean |
isBinary()
|
boolean |
isCommutative()
|
boolean |
isComposite()
|
boolean |
isDistributiveOver(Operator op)
|
boolean |
isEquivilence()
|
boolean |
isNary()
|
boolean |
isPrefix()
|
boolean |
isReflexive()
|
boolean |
isSelfInverse()
|
boolean |
isSufix()
|
boolean |
isSymmetric()
|
boolean |
isTransitive()
|
boolean |
isUnary()
|
int |
numArgs()
|
protected void |
setBinaryInverseOp(Operator inv)
|
protected void |
setDistributiveOver(Operator op)
|
protected void |
setInverseOp(Operator inv)
|
protected void |
setPrecedence(int i)
|
protected void |
setRootOp(Operator root)
|
java.lang.String |
toFullString()
returns a verbose representation of the operator and all its properties. |
boolean |
useBindingForPrint()
|
Methods inherited from class org.nfunk.jep.Operator |
---|
getName, getPFMC, getSymbol, setPFMC, toString |
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 SUFIX
public static final int SELF_INVERSE
public static final int COMPOSITE
public static final int USE_BINDING_FOR_PRINT
Constructor Detail |
---|
public XOperator(java.lang.String name, PostfixMathCommandI pfmc, int flags)
name
- printable name of operatorpfmc
- postfix math command for opperatorflags
- set of flags defining the porperties of the operator.public XOperator(java.lang.String name, PostfixMathCommandI pfmc, int flags, int precedence)
name
- pfmc
- flags
- precedence
- public XOperator(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 opperatorflags
- set of flags defining the porperties of the operator.public XOperator(java.lang.String name, java.lang.String symbol, PostfixMathCommandI pfmc, int flags, int precedence)
name
- pfmc
- flags
- precedence
- public XOperator(Operator op, int flags, int precedence)
public XOperator(Operator op, int flags)
Method Detail |
---|
public final int getPrecedence()
protected final void setPrecedence(int i)
protected final void setDistributiveOver(Operator op)
public boolean isDistributiveOver(Operator op)
protected void setRootOp(Operator root)
protected void setInverseOp(Operator inv)
protected void setBinaryInverseOp(Operator inv)
public Operator getRootOp()
public Operator getInverseOp()
public Operator getBinaryInverseOp()
public final int getBinding()
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 isSufix()
public final boolean isComposite()
public final boolean isSelfInverse()
public final boolean useBindingForPrint()
public java.lang.String toFullString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |