|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--openjava.ptree.ParseTreeObject | +--openjava.ptree.Leaf | +--openjava.ptree.Literal
The Literal class
represents
a literal.
Leaf
,
Expression
Field Summary | |
static int |
BOOLEAN
|
static int |
CHARACTER
|
private static Literal |
constantEmptyString_
|
private static Literal |
constantFalse_
|
private static Literal |
constantNull_
|
private static Literal |
constantOne_
|
private static Literal |
constantTrue_
|
private static Literal |
constantZero_
|
static int |
DOUBLE
|
static int |
FLOAT
|
protected int |
id
|
static int |
INTEGER
|
static int |
LONG
|
static int |
NULL
|
static int |
STRING
|
Fields inherited from class openjava.ptree.Leaf |
charBegin, line |
Fields inherited from class openjava.ptree.ParseTreeObject |
debugFlag, debugLevel, LN, out, writerStack |
Constructor Summary | |
Literal(int id,
String str)
Allocates a new object. |
Method Summary | |
void |
accept(ParseTreeVisitor v)
Accepts a ParseTreeVisitor object as the role of a
Visitor in the Visitor pattern, as the role of an Element in the
Visitor pattern. |
static Literal |
constantEmptyString()
|
static Literal |
constantFalse()
|
static Literal |
constantNull()
|
static Literal |
constantOne()
|
static Literal |
constantTrue()
|
static Literal |
constantZero()
|
private static String |
doubleQuoteString(String s)
|
int |
getLiteralType()
|
OJClass |
getType(Environment env)
|
static Literal |
makeLiteral(boolean b)
Makes a new object of Literal class
from the boolean. |
static Literal |
makeLiteral(Boolean b)
|
static Literal |
makeLiteral(char c)
Makes a new object of Literal class
from the character. |
static Literal |
makeLiteral(Character c)
|
static Literal |
makeLiteral(double num)
Makes a new object of Literal class
from the number. |
static Literal |
makeLiteral(Double d)
|
static Literal |
makeLiteral(float num)
Makes a new object of Literal class
from the number. |
static Literal |
makeLiteral(Float f)
|
static Literal |
makeLiteral(int num)
Makes a new object of Literal class
from the number. |
static Literal |
makeLiteral(Integer n)
|
static Literal |
makeLiteral(long num)
Makes a new object of Literal class
from the number. |
static Literal |
makeLiteral(Long n)
|
static Literal |
makeLiteral(String str)
Makes a new object of Literal class
from the string. |
private static String |
singleQuoteChar(char c)
|
static String |
stripString(String s)
Given a double-quoted string, returns the string without double-quotes. |
Methods inherited from class openjava.ptree.Leaf |
childrenAccept, equals, equals, getRowType, getTokenID, makeCopy, makeRecursiveCopy, replaceChildWith, toString, writeCode |
Methods inherited from class openjava.ptree.ParseTreeObject |
clone, eq, eq, equal, flushPrintWriter, getDebugFlag, getNest, getObjectID, getParent, getPrintWriter, getTab, hashCode, lastObjectID, popNest, popPrintWriter, pushNest, pushPrintWriter, replace, setDebugFlag, setDebugLevel, setNest, setParent, setPrintStream, setTab, toFlattenString, writeDebug, writeDebugL, writeDebugLln, writeDebugln, writeDebugLR, writeDebugR, writeDebugRln, writeTab |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface openjava.ptree.Expression |
getRowType |
Methods inherited from interface openjava.ptree.ParseTree |
childrenAccept, eq, equals, getObjectID, makeCopy, makeRecursiveCopy, replace, toFlattenString, toString, writeCode |
Field Detail |
public static final int BOOLEAN
getLiteralType()
,
Constant Field Valuespublic static final int INTEGER
public static final int LONG
public static final int FLOAT
public static final int DOUBLE
public static final int CHARACTER
public static final int STRING
public static final int NULL
protected int id
private static Literal constantTrue_
private static Literal constantFalse_
private static Literal constantNull_
private static Literal constantEmptyString_
private static Literal constantZero_
private static Literal constantOne_
Constructor Detail |
public Literal(int id, String str)
String
literal like
"test"
,
call this constructor in the form :
new Literal( Literal.STRING, "\"test\"" )
id
- the id number of the literal.str
- the literal as a String.makeLiteral(String)
Method Detail |
public static Literal makeLiteral(String str)
Literal
class
from the string.
str
- the string.private static String doubleQuoteString(String s)
public static Literal makeLiteral(boolean b)
Literal
class
from the boolean.
b
- the boolean.public static Literal makeLiteral(Boolean b)
public static Literal makeLiteral(char c)
Literal
class
from the character.
c
- the character.private static String singleQuoteChar(char c)
public static Literal makeLiteral(Character c)
public static Literal makeLiteral(int num)
Literal
class
from the number.
num
- the number.public static Literal makeLiteral(Integer n)
public static Literal makeLiteral(long num)
Literal
class
from the number.
num
- the number.public static Literal makeLiteral(Long n)
public static Literal makeLiteral(float num)
Literal
class
from the number.
num
- the number.public static Literal makeLiteral(Float f)
public static Literal makeLiteral(double num)
Literal
class
from the number.
num
- the number.public static Literal makeLiteral(Double d)
public int getLiteralType()
public static Literal constantTrue()
public static Literal constantFalse()
public static Literal constantNull()
public static Literal constantEmptyString()
public static Literal constantZero()
public static Literal constantOne()
public OJClass getType(Environment env) throws Exception
getType
in interface Expression
Exception
public void accept(ParseTreeVisitor v) throws ParseTreeException
ParseTree
ParseTreeVisitor
object as the role of a
Visitor in the Visitor pattern, as the role of an Element in the
Visitor pattern.
This invoke an appropriate visit()
method on the
accepted visitor.
accept
in interface ParseTree
accept
in class Leaf
v
- a visitor
ParseTreeException
public static String stripString(String s)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |