|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.teatrove.tea.parsetree.Node
org.teatrove.tea.parsetree.Expression
org.teatrove.tea.parsetree.Literal
org.teatrove.tea.parsetree.NumberLiteral
public class NumberLiteral
Base class for all Literals that have a numeric type.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.teatrove.tea.parsetree.Expression |
|---|
Expression.Conversion |
| Constructor Summary | |
|---|---|
NumberLiteral(SourceInfo info,
double value)
|
|
NumberLiteral(SourceInfo info,
float value)
|
|
NumberLiteral(SourceInfo info,
int value)
|
|
NumberLiteral(SourceInfo info,
long value)
|
|
NumberLiteral(SourceInfo info,
Number value)
|
|
| Method Summary | |
|---|---|
Object |
accept(NodeVisitor visitor)
Every subclass of Node must override this method with the following: return visitor.visit(this). |
void |
convertTo(Type type,
boolean preferCast)
Applies a type conversion to this expression which is chained to all previous conversions. |
Object |
getValue()
Most expressions can't generate a value at compile-time, so this method simply returns null. |
boolean |
isValueKnown()
Value is known only if type is a number or can be assigned a number. |
void |
setType(Type type)
Sets the type of this expression, clearing the conversion chain. |
| Methods inherited from class org.teatrove.tea.parsetree.Expression |
|---|
clone, convertTo, forceConversion, getConversionChain, getInitialType, getType, isExceptionPossible, setInitialType |
| Methods inherited from class org.teatrove.tea.parsetree.Node |
|---|
getSourceInfo, toString |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public NumberLiteral(SourceInfo info,
Number value)
public NumberLiteral(SourceInfo info,
int value)
public NumberLiteral(SourceInfo info,
float value)
public NumberLiteral(SourceInfo info,
long value)
public NumberLiteral(SourceInfo info,
double value)
| Method Detail |
|---|
public Object accept(NodeVisitor visitor)
Nodereturn visitor.visit(this).
accept in class Literalvisitor - A visitor of this Node
NodeVisitor
public void convertTo(Type type,
boolean preferCast)
Expression
convertTo in class Expressiontype - the type to convert to.preferCast - a hint that the conversion should be performed by a
type cast operation, by default is true.public void setType(Type type)
Expression
setType in class Expressionpublic Object getValue()
Expression
getValue in class Expressionpublic boolean isValueKnown()
isValueKnown in class LiteralLiteral
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||