Package picasso.parser.tokens.chars
Class CharToken
- java.lang.Object
-
- picasso.parser.tokens.Token
-
- picasso.parser.tokens.chars.CharToken
-
- Direct Known Subclasses:
AdditionToken
,BinaryExpToken
,CommaToken
,DivisionToken
,EqualsToken
,LeftBracketToken
,LeftParenToken
,ModToken
,MultiplyToken
,NegationToken
,QuoteToken
,RightBracketToken
,RightParenToken
,SubtractionToken
public class CharToken extends Token
A token represented by a single character, e.g., '*', ';', '[' and so on; the method equals compares a CharToken as equal to another CharToken encapsulating the same character.Client code should use CharTokenFactory to get a CharToken object, the constructor is package access only
-
-
Field Summary
-
Fields inherited from class picasso.parser.tokens.Token
ADD_OR_SUBTRACT, ASSIGNMENT, CONSTANT, EXPONENTIATION, GROUPING, MULTIPLY_OR_DIVIDE, UNARY
-
-
Constructor Summary
Constructors Constructor Description CharToken(int ch)
Represents the given single-character token
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
boolean
isConstant()
Returns true if this token represents a constant, false otherwiseboolean
isFunction()
Returns true if this token represents a function, false otherwiseString
toString()
Represents the token by its descriptionint
value()
-
Methods inherited from class picasso.parser.tokens.Token
getPrecedence
-
-
-
-
Method Detail
-
equals
public boolean equals(Object o)
-
value
public int value()
- Returns:
- the encapsulated value
-
toString
public String toString()
Description copied from class:Token
Represents the token by its description
-
isConstant
public boolean isConstant()
Description copied from class:Token
Returns true if this token represents a constant, false otherwise- Specified by:
isConstant
in classToken
- Returns:
- true iff this Token represents a constant
-
isFunction
public boolean isFunction()
Description copied from class:Token
Returns true if this token represents a function, false otherwise- Specified by:
isFunction
in classToken
- Returns:
- true iff this Token represents a function
-
-