koala.dynamicjava.tree
Class Literal

java.lang.Object
  extended by koala.dynamicjava.tree.Node
      extended by koala.dynamicjava.tree.Expression
          extended by koala.dynamicjava.tree.PrimaryExpression
              extended by koala.dynamicjava.tree.Literal
All Implemented Interfaces:
SourceInfo.Wrapper
Direct Known Subclasses:
BooleanLiteral, CharacterLiteral, DoubleLiteral, FloatLiteral, IntegerLiteral, LongLiteral, NullLiteral, StringLiteral

public abstract class Literal
extends PrimaryExpression

This class represents the literal nodes of the syntax tree

Version:
1.0 - 1999/04/24
Author:
Stephane Hillion

Constructor Summary
protected Literal(java.lang.String rep, java.lang.Object val, java.lang.Class<?> typ, SourceInfo si)
          Initializes a literal
 
Method Summary
<T> T
acceptVisitor(Visitor<T> visitor)
          Allows a visitor to traverse the tree
 java.lang.String getRepresentation()
          Returns the representation of this object
 java.lang.Class<?> getType()
          Returns the type of this expression.
 java.lang.Object getValue()
          Returns the value of this expression
 void setRepresentation(java.lang.String s)
          Sets the representation of this object
 void setType(java.lang.Class<?> c)
          Sets the type of this object
 void setValue(java.lang.Object o)
          Sets the value of this object
 java.lang.String toString()
          Implementation of toString for use in unit testing
 
Methods inherited from class koala.dynamicjava.tree.Node
archiveProperties, getProperties, getProperty, getSourceInfo, hasProperty, setProperty, setSourceInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Literal

protected Literal(java.lang.String rep,
                  java.lang.Object val,
                  java.lang.Class<?> typ,
                  SourceInfo si)
Initializes a literal

Parameters:
rep - the representation of the literal
val - the value of this literal
typ - the type of this literal
Throws:
java.lang.IllegalArgumentException - if rep is null
Method Detail

getRepresentation

public java.lang.String getRepresentation()
Returns the representation of this object


setRepresentation

public void setRepresentation(java.lang.String s)
Sets the representation of this object

Throws:
java.lang.IllegalArgumentException - if s is null

getValue

public java.lang.Object getValue()
Returns the value of this expression


setValue

public void setValue(java.lang.Object o)
Sets the value of this object

Throws:
java.lang.IllegalArgumentException - if o is null

getType

public java.lang.Class<?> getType()
Returns the type of this expression. NOTE: the 'null' literal has a null type


setType

public void setType(java.lang.Class<?> c)
Sets the type of this object


acceptVisitor

public <T> T acceptVisitor(Visitor<T> visitor)
Allows a visitor to traverse the tree

Specified by:
acceptVisitor in class Node
Parameters:
visitor - the visitor to accept

toString

public java.lang.String toString()
Implementation of toString for use in unit testing

Overrides:
toString in class java.lang.Object