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 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()-
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: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
-
-