cetus.hir
Class VariableDeclarator

java.lang.Object
  extended by cetus.hir.Declarator
      extended by cetus.hir.VariableDeclarator
All Implemented Interfaces:
Printable, Symbol, Traversable, java.lang.Cloneable

public class VariableDeclarator
extends Declarator
implements Symbol

Represents a declarator for a variable in a VariableDeclaration.


Field Summary
 
Fields inherited from class cetus.hir.Declarator
children, leading_specs, object_print_method, parent, trailing_specs
 
Constructor Summary
VariableDeclarator(IDExpression direct_decl)
          Create a new VariableDeclarator.
VariableDeclarator(IDExpression direct_decl, java.util.List trailing_specs)
           
VariableDeclarator(IDExpression direct_decl, Specifier spec)
           
VariableDeclarator(java.util.List leading_specs, IDExpression direct_decl)
           
VariableDeclarator(java.util.List leading_specs, IDExpression direct_decl, java.util.List trailing_specs)
           
VariableDeclarator(Specifier spec, IDExpression direct_decl)
           
 
Method Summary
 java.lang.Object clone()
           
static void defaultPrint(VariableDeclarator dec, java.io.OutputStream stream)
          Prints a variable declarator to a stream.
 java.util.List getArraySpecifiers()
          Returns a List of ArraySpecifier
 IDExpression getDirectDeclarator()
           
 Initializer getInitializer()
           
 java.util.List getSpecifiers()
           
 IDExpression getSymbol()
          Returns the symbol declared by this declarator.
 java.lang.String getSymbolName()
          Returns the name of the symbol.
 java.util.List getTrailingSpecifiers()
           
 java.util.List getTypeSpecifiers()
          Returns a list of type specifiers.
static void setClassPrintMethod(java.lang.reflect.Method m)
          Overrides the class print method, so that all subsequently created objects will use the supplied method.
 void setInitializer(Initializer init)
          Sets the initial value of the variable.
 java.lang.String toString()
           
 
Methods inherited from class cetus.hir.Declarator
addParameter, addParameterAfter, addParameterBefore, addTrailingSpecifier, defaultPrint, getChildren, getParameters, getParent, print, removeChild, setChild, setParent
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

VariableDeclarator

public VariableDeclarator(IDExpression direct_decl)
Create a new VariableDeclarator.


VariableDeclarator

public VariableDeclarator(IDExpression direct_decl,
                          java.util.List trailing_specs)

VariableDeclarator

public VariableDeclarator(IDExpression direct_decl,
                          Specifier spec)

VariableDeclarator

public VariableDeclarator(java.util.List leading_specs,
                          IDExpression direct_decl)

VariableDeclarator

public VariableDeclarator(java.util.List leading_specs,
                          IDExpression direct_decl,
                          java.util.List trailing_specs)

VariableDeclarator

public VariableDeclarator(Specifier spec,
                          IDExpression direct_decl)
Method Detail

clone

public java.lang.Object clone()
Overrides:
clone in class Declarator

defaultPrint

public static void defaultPrint(VariableDeclarator dec,
                                java.io.OutputStream stream)
Prints a variable declarator to a stream.

Parameters:
dec - The declarator to print.
stream - The stream on which to print the declarator.

toString

public java.lang.String toString()
Overrides:
toString in class Declarator

getDirectDeclarator

public IDExpression getDirectDeclarator()

getSpecifiers

public java.util.List getSpecifiers()
Overrides:
getSpecifiers in class Declarator

getSymbol

public IDExpression getSymbol()
Returns the symbol declared by this declarator.

Overrides:
getSymbol in class Declarator

getTrailingSpecifiers

public java.util.List getTrailingSpecifiers()

setClassPrintMethod

public static void setClassPrintMethod(java.lang.reflect.Method m)
Overrides the class print method, so that all subsequently created objects will use the supplied method.

Parameters:
m - The new print method.

getInitializer

public Initializer getInitializer()
Overrides:
getInitializer in class Declarator

setInitializer

public void setInitializer(Initializer init)
Description copied from class: Declarator
Sets the initial value of the variable. The initial value cannot be set in the constructor, for the purpose of limiting the number of constructors.

Overrides:
setInitializer in class Declarator
Parameters:
init - An initial value for the variable.

getSymbolName

public java.lang.String getSymbolName()
Description copied from interface: Symbol
Returns the name of the symbol.

Specified by:
getSymbolName in interface Symbol
Returns:
the name of the symbol.

getTypeSpecifiers

public java.util.List getTypeSpecifiers()
Description copied from interface: Symbol
Returns a list of type specifiers.

Specified by:
getTypeSpecifiers in interface Symbol
Returns:
the list of type specifiers.

getArraySpecifiers

public java.util.List getArraySpecifiers()
Description copied from class: Declarator
Returns a List of ArraySpecifier

Specified by:
getArraySpecifiers in interface Symbol
Overrides:
getArraySpecifiers in class Declarator
Returns:
An empty list if there is no ArraySpecifier for this Declarator.