public class XOperator extends Operator
Operators have a number of properties:
Modifier and Type | Field and Description |
---|---|
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 ?: and or higher like [x,y,z,w]
|
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) !(!x)
|
static int |
SUFIX
postfix operators x%, if neiter prefix and postif then infix, if both trifix like x?y:z
|
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 !x ~x
|
static int |
USE_BINDING_FOR_PRINT
For non commutative operators printing can be determined by the left or right binding.
|
Constructor and Description |
---|
XOperator(Operator op,
int flags) |
XOperator(Operator op,
int flags,
int precedence) |
XOperator(String name,
PostfixMathCommandI pfmc,
int flags)
construct a new operator.
|
XOperator(String name,
PostfixMathCommandI pfmc,
int flags,
int precedence)
Allows a given precedent to be set.
|
XOperator(String name,
String symbol,
PostfixMathCommandI pfmc,
int flags)
construct a new operator, with a different name and symbol
|
XOperator(String name,
String symbol,
PostfixMathCommandI pfmc,
int flags,
int precedence)
Allows a given precedent to be set.
|
Modifier and Type | Method and Description |
---|---|
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() |
String |
toFullString()
returns a verbose representation of the operator and all its properties.
|
boolean |
useBindingForPrint() |
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
public XOperator(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(String name, PostfixMathCommandI pfmc, int flags, int precedence)
name
- pfmc
- flags
- precedence
- public XOperator(String name, 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(String name, 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)
public final int getPrecedence()
public boolean isDistributiveOver(Operator op)
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 String toFullString()
Jas4pp 1.5 © Java Analysis Studio for Particle Physics