koala.dynamicjava.tree
Class ArrayAllocation

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.ArrayAllocation
All Implemented Interfaces:
SourceInfo.Wrapper

public class ArrayAllocation
extends PrimaryExpression

This class represents the array allocation nodes of the syntax tree

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

Nested Class Summary
static class ArrayAllocation.TypeDescriptor
          This class contains informations about the array to create
 
Constructor Summary
ArrayAllocation(TypeName tp, ArrayAllocation.TypeDescriptor td)
          Initializes the expression
ArrayAllocation(TypeName tp, ArrayAllocation.TypeDescriptor td, SourceInfo si)
          Initializes the expression
 
Method Summary
<T> T
acceptVisitor(Visitor<T> visitor)
          Allows a visitor to traverse the tree
 int getDimension()
          Returns the dimension of the array
 TypeName getElementType()
          Returns the creation type
 ArrayInitializer getInitialization()
          Returns the initialization expression
 List<Expression> getSizes()
          Returns the size expressions
 void setDimension(int dim)
          Note: This method doesn't follow the usual convention of firing a property change.
 void setElementType(TypeName t)
          Sets the creation type
 void setInitialization(ArrayInitializer init)
          Note: This method doesn't follow the usual convention of firing a property change.
 void setSizes(List<? extends Expression> sz)
          Note: This method doesn't follow the usual convention of firing a property change.
 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

ArrayAllocation

public ArrayAllocation(TypeName tp,
                       ArrayAllocation.TypeDescriptor td)
Initializes the expression

Parameters:
tp - the type prefix
td - the type descriptor
Throws:
IllegalArgumentException - if tp is null or td is null

ArrayAllocation

public ArrayAllocation(TypeName tp,
                       ArrayAllocation.TypeDescriptor td,
                       SourceInfo si)
Initializes the expression

Parameters:
tp - the type prefix
td - the type descriptor. The element type of the enclosed initializer will be automatically and recursively set.
Throws:
IllegalArgumentException - if tp is null or td is null
Method Detail

getElementType

public TypeName getElementType()
Returns the creation type


setElementType

public void setElementType(TypeName t)
Sets the creation type

Throws:
IllegalArgumentException - if t is null

getDimension

public int getDimension()
Returns the dimension of the array


setDimension

public void setDimension(int dim)
Note: This method doesn't follow the usual convention of firing a property change. If that functionality is needed, the code should be fixed.


getSizes

public List<Expression> getSizes()
Returns the size expressions


setSizes

public void setSizes(List<? extends Expression> sz)
Note: This method doesn't follow the usual convention of firing a property change. If that functionality is needed, the code should be fixed.


getInitialization

public ArrayInitializer getInitialization()
Returns the initialization expression


setInitialization

public void setInitialization(ArrayInitializer init)
Note: This method doesn't follow the usual convention of firing a property change. If that functionality is needed, the code should be fixed.

Parameters:
init - An initializer, assumed to already be set up with a valid element type. (The ArrayInitializer constructor will set up the element type automatically, but this method does not.)

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 String toString()
Implementation of toString for use in unit testing

Overrides:
toString in class Object