public class Token
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
OperatorList |
Constructor and Description |
---|
Token(java.lang.Double d)
Build a number Token from a Double.
|
Token(java.lang.String s)
Build a Token from a String.
|
Modifier and Type | Method and Description |
---|---|
boolean |
hasHigherPrecedenceThan(Token other)
Whether or not the Token has higher precedence than other Token
|
boolean |
isLeftParen()
Whether or not the Token is a left parentheses.
|
boolean |
isNumber()
Whether or not the Token is a number.
|
boolean |
isOperator()
Whether or not the Token is an operator.
|
boolean |
isRightParen()
Whether or not the Token is a right parentheses.
|
java.lang.Double |
numberValue()
The numeric value of the Token if it is a number Token
Throws IllegalArgumentException if Token is not a number
|
java.lang.Character |
operatorCharValue()
The character value of the Token if it is an operator Token
Throws IllegalArgumentException if Token is not an operator
|
java.lang.String |
toString()
String representation of the Token
|
public static final java.lang.String OperatorList
public Token(java.lang.String s)
s
- String containing a potential Token.
Will throw IllegalArgumentException if Token cannot be built.public Token(java.lang.Double d)
s
- Double containing a Token.public boolean isNumber()
public boolean isOperator()
public boolean isLeftParen()
public boolean isRightParen()
public boolean hasHigherPrecedenceThan(Token other)
public java.lang.Double numberValue()
public java.lang.Character operatorCharValue()
public java.lang.String toString()
toString
in class java.lang.Object