Enum Class Parser.Operator
- All Implemented Interfaces:
Serializable, Comparable<Parser.Operator>, Constable
- Enclosing class:
Parser
-
Nested Class Summary
Nested classes/interfaces inherited from class Enum
Enum.EnumDesc<E> -
Enum Constant Summary
Enum Constants -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiontoString()static Parser.OperatorReturns the enum constant of this class with the specified name.static Parser.Operator[]values()Returns an array containing the constants of this enum class, in the order they are declared.
-
Enum Constant Details
-
STOP
A dummy operator with low precedence. When parsing subexpressions, we always stop when we reach an operator of lower precedence than the "current precedence". For example, when parsing1 + 2 * 3 + 4, we'll stop parsing the subexpression* 3 + 4when 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 ⊙. -
OR
-
AND
-
EQUAL
-
NOT_EQUAL
-
LESS
-
LESS_OR_EQUAL
-
GREATER
-
GREATER_OR_EQUAL
-
PLUS
-
MINUS
-
TIMES
-
DIVIDE
-
REMAINDER
-
-
Field Details
-
symbol
-
precedence
final int precedence
-
-
Constructor Details
-
Operator
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-
toString
- Overrides:
toStringin classEnum<Parser.Operator>
-