Class LiteralBaseToken
- java.lang.Object
-
- com.tangosol.coherence.dsltools.base.BaseToken
-
- com.tangosol.coherence.dsltools.base.LeafBaseToken
-
- com.tangosol.coherence.dsltools.base.LiteralBaseToken
-
public class LiteralBaseToken extends LeafBaseToken
LiteralBaseToken is the BaseToken that represents literals such as String, Integer, Long, Float, and Double.- Author:
- djl 2009.03.14
-
-
Field Summary
Fields Modifier and Type Field Description static int
BOOLEANLITERAL
The numberic code for a boolean literalstatic int
DOUBLELITERAL
The numberic code for a double literalstatic int
FLOATLITERAL
The numberic code for a float literalstatic int
INTEGERLITERAL
The numberic code for a integer literalstatic int
LONGLITERAL
The numberic code for a long literalstatic int
NULLLITERAL
The numberic code for a boolean literalstatic int
SHORTLITERAL
The numberic code for a short literalstatic int
STRINGLITERAL
The numberic code for a string literal
-
Constructor Summary
Constructors Constructor Description LiteralBaseToken(int nType, String s)
Construct a new LiteralBaseToken with the given parameters.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LiteralBaseToken
createBoolean(String s)
Create new LiteralBaseToken representing a Boolean with given valuestatic LiteralBaseToken
createDouble(String s)
Create new LiteralBaseToken representing a Double with given valuestatic LiteralBaseToken
createFloat(String s)
Create new LiteralBaseToken representing a float with given valuestatic LiteralBaseToken
createInteger(String s)
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
createShort(String s)
Create new LiteralBaseToken representing a Integer with given valuestatic LiteralBaseToken
createString(String s)
Create new LiteralBaseToken representing a String with given valueint
getType()
Obtain the type code of this token.String
getValue()
Return the string representation of this LeafBaseToken.boolean
isLiteral()
Answer whether this token represents a literal.String
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 Detail
-
STRINGLITERAL
public static final int STRINGLITERAL
The numberic code for a string literal- See Also:
- Constant Field Values
-
INTEGERLITERAL
public static final int INTEGERLITERAL
The numberic code for a integer literal- See Also:
- Constant Field Values
-
LONGLITERAL
public static final int LONGLITERAL
The numberic code for a long literal- See Also:
- Constant Field Values
-
FLOATLITERAL
public static final int FLOATLITERAL
The numberic code for a float literal- See Also:
- Constant Field Values
-
DOUBLELITERAL
public static final int DOUBLELITERAL
The numberic code for a double literal- See Also:
- Constant Field Values
-
BOOLEANLITERAL
public static final int BOOLEANLITERAL
The numberic code for a boolean literal- See Also:
- Constant Field Values
-
NULLLITERAL
public static final int NULLLITERAL
The numberic code for a boolean literal- See Also:
- Constant Field Values
-
SHORTLITERAL
public static final int SHORTLITERAL
The numberic code for a short literal- See Also:
- Constant Field Values
-
-
Constructor Detail
-
LiteralBaseToken
public LiteralBaseToken(int nType, String s)
Construct a new LiteralBaseToken with the given parameters.- Parameters:
nType
- the type code for the tokens
- the string representation for the token
-
-
Method Detail
-
getValue
public String 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
public String toString()
Return a human-readable description for this token.- Overrides:
toString
in classLeafBaseToken
- Returns:
- a String description of the token
-
createString
public static LiteralBaseToken createString(String s)
Create new LiteralBaseToken representing a String with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a String
-
createShort
public static LiteralBaseToken createShort(String s)
Create new LiteralBaseToken representing a Integer with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Integer
-
createInteger
public static LiteralBaseToken createInteger(String s)
Create new LiteralBaseToken representing a Integer with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Integer
-
createLong
public static LiteralBaseToken createLong(String s)
Create new LiteralBaseToken representing a Long with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Long
-
createFloat
public static LiteralBaseToken createFloat(String s)
Create new LiteralBaseToken representing a float with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Float
-
createDouble
public static LiteralBaseToken createDouble(String s)
Create new LiteralBaseToken representing a Double with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Double
-
createBoolean
public static LiteralBaseToken createBoolean(String s)
Create new LiteralBaseToken representing a Boolean with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Double
-
createNull
public static LiteralBaseToken createNull(String s)
Create new LiteralBaseToken representing a null with given value- Parameters:
s
- the text of the literal- Returns:
- a LiteralBaseToken for a Double
-
-