Modifier and Type | Method and Description |
---|---|
boolean |
associates(Operator op)
returns true iff:
A this ( B op C)
is the same as
(A this B) op C
|
boolean |
commutes()
do you get the same result if the order of the arguments is swapped.
|
boolean |
leftDistributive(Operator op)
returns true iff:
A this ( B op C )
is the same as
(A this B) op ( A this C)
|
abstract java.lang.Number |
operate(java.lang.Number a,
java.lang.Number b) |
boolean |
rightDistributive(Operator op)
returns true iff:
( A op B ) this C
is the same as
(A this C) op ( B this C)
|
abstract java.lang.String |
text() |
static Operator |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Operator[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Operator ADD
public static final Operator SUB
public static final Operator MUL
public static final Operator DIV
public static Operator[] values()
for (Operator c : Operator.values()) System.out.println(c);
public static Operator valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic abstract java.lang.Number operate(java.lang.Number a, java.lang.Number b)
public abstract java.lang.String text()
public boolean associates(Operator op)
op
- public boolean leftDistributive(Operator op)
op
- public boolean rightDistributive(Operator op)
op
- public boolean commutes()