Package picasso.parser.tokens.chars
Class CharToken
- java.lang.Object
-
- picasso.parser.tokens.Token
-
- picasso.parser.tokens.chars.CharToken
-
- Direct Known Subclasses:
AssignmentToken,CaretToken,CommaToken,InvertToken,LeftBracketToken,LeftParenToken,MinusToken,ModToken,PlusToken,RightBracketToken,RightParenToken,SlashToken,StarToken
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
-
-
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 booleanequals(Object o)booleanisConstant()Returns true if this token represents a constant, false otherwisebooleanisFunction()Returns true if this token represents a function, false otherwiseStringtoString()Represents the token by its descriptionintvalue()
-
-
-
Method Detail
-
equals
public boolean equals(Object o)
-
value
public int value()
- Returns:
- the encapsulated value
-
toString
public String toString()
Description copied from class:TokenRepresents the token by its description
-
isConstant
public boolean isConstant()
Description copied from class:TokenReturns true if this token represents a constant, false otherwise- Specified by:
isConstantin classToken- Returns:
- true iff this Token represents a constant
-
isFunction
public boolean isFunction()
Description copied from class:TokenReturns true if this token represents a function, false otherwise- Specified by:
isFunctionin classToken- Returns:
- true iff this Token represents a function
-
-