Class LiteralBaseToken
java.lang.Object
com.tangosol.coherence.dsltools.base.BaseToken
com.tangosol.coherence.dsltools.base.LeafBaseToken
com.tangosol.coherence.dsltools.base.LiteralBaseToken
LiteralBaseToken is the BaseToken that represents literals such as String,
Integer, Long, Float, and Double.
- Author:
- djl 2009.03.14
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The numberic code for a boolean literalstatic final int
The numberic code for a double literalstatic final int
The numberic code for a float literalstatic final int
The numberic code for a integer literalstatic final int
The numberic code for a long literalstatic final int
The numberic code for a boolean literalstatic final int
The numberic code for a short literalstatic final int
The numberic code for a string literal -
Constructor Summary
ConstructorDescriptionLiteralBaseToken
(int nType, String s) Construct a new LiteralBaseToken with the given parameters. -
Method Summary
Modifier and TypeMethodDescriptionstatic LiteralBaseToken
Create new LiteralBaseToken representing a Boolean with given valuestatic LiteralBaseToken
Create new LiteralBaseToken representing a Double with given valuestatic LiteralBaseToken
Create new LiteralBaseToken representing a float with given valuestatic LiteralBaseToken
Create new LiteralBaseToken representing a Integer with given valuestatic LiteralBaseToken
createLong
(String s) Create new LiteralBaseToken representing a Long with given valuestatic LiteralBaseToken
createNull
(String s) Create new LiteralBaseToken representing a null with given valuestatic LiteralBaseToken
Create new LiteralBaseToken representing a Integer with given valuestatic LiteralBaseToken
Create new LiteralBaseToken representing a String with given valueint
getType()
Obtain the type code of this token.getValue()
Return the string representation of this LeafBaseToken.boolean
Answer whether this token represents a literal.toString()
Return a human-readable description for this token.Methods inherited from class com.tangosol.coherence.dsltools.base.LeafBaseToken
isCompound, isLeaf, match
Methods inherited from class com.tangosol.coherence.dsltools.base.BaseToken
getSimpleName, isIdentifier, isNest, isOperator, isPunctuation, match
-
Field Details
-
STRINGLITERAL
public static final int STRINGLITERALThe numberic code for a string literal- See Also:
-
INTEGERLITERAL
public static final int INTEGERLITERALThe numberic code for a integer literal- See Also:
-
LONGLITERAL
public static final int LONGLITERALThe numberic code for a long literal- See Also:
-
FLOATLITERAL
public static final int FLOATLITERALThe numberic code for a float literal- See Also:
-
DOUBLELITERAL
public static final int DOUBLELITERALThe numberic code for a double literal- See Also:
-
BOOLEANLITERAL
public static final int BOOLEANLITERALThe numberic code for a boolean literal- See Also:
-
NULLLITERAL
public static final int NULLLITERALThe numberic code for a boolean literal- See Also:
-
SHORTLITERAL
public static final int SHORTLITERALThe numberic code for a short literal- See Also:
-
-
Constructor Details
-
LiteralBaseToken
Construct a new LiteralBaseToken with the given parameters.- Parameters:
nType
- the type code for the tokens
- the string representation for the token
-
-
Method Details
-
getValue
Return the string representation of this LeafBaseToken.- Specified by:
getValue
in classLeafBaseToken
- Returns:
- the string that represents the reciever
-
isLiteral
public boolean isLiteral()Answer whether this token represents a literal. -
getType
public int getType()Obtain the type code of this token.- Returns:
- the type code
-
toString
Return a human-readable description for this token.- Overrides:
toString
in classLeafBaseToken
- Returns:
- a String description of the token
-
createString
Create new LiteralBaseToken representing a String with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a String
-
createShort
Create new LiteralBaseToken representing a Integer with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Integer
-
createInteger
Create new LiteralBaseToken representing a Integer with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Integer
-
createLong
Create new LiteralBaseToken representing a Long with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Long
-
createFloat
Create new LiteralBaseToken representing a float with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Float
-
createDouble
Create new LiteralBaseToken representing a Double with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Double
-
createBoolean
Create new LiteralBaseToken representing a Boolean with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Double
-
createNull
Create new LiteralBaseToken representing a null with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Double
-