static enum Parser.Operator extends java.lang.Enum<Parser.Operator>
Enum Constant and Description |
---|
AND |
DIVIDE |
EQUAL |
GREATER |
GREATER_OR_EQUAL |
LESS |
LESS_OR_EQUAL |
MINUS |
NOT_EQUAL |
OR |
PLUS |
REMAINDER |
STOP
A dummy operator with low precedence.
|
TIMES |
Modifier and Type | Field and Description |
---|---|
(package private) int |
precedence |
(package private) java.lang.String |
symbol |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
toString() |
static Parser.Operator |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static Parser.Operator[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final Parser.Operator STOP
1 + 2 * 3 + 4
, we'll stop parsing the subexpression * 3 + 4
when
we reach the +
because it has lower precedence than *
. This dummy operator,
then, behaves like +
when the minimum precedence is *
. We also return it
if we're looking for an operator and don't find one. If this operator is ⊙
, it's as
if our expressions are bracketed with it, like ⊙ 1 + 2 * 3 + 4 ⊙
.public static final Parser.Operator OR
public static final Parser.Operator AND
public static final Parser.Operator EQUAL
public static final Parser.Operator NOT_EQUAL
public static final Parser.Operator LESS
public static final Parser.Operator LESS_OR_EQUAL
public static final Parser.Operator GREATER
public static final Parser.Operator GREATER_OR_EQUAL
public static final Parser.Operator PLUS
public static final Parser.Operator MINUS
public static final Parser.Operator TIMES
public static final Parser.Operator DIVIDE
public static final Parser.Operator REMAINDER
public static Parser.Operator[] values()
for (Parser.Operator c : Parser.Operator.values()) System.out.println(c);
public static Parser.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 java.lang.String toString()
toString
in class java.lang.Enum<Parser.Operator>