openjava.ptree
Class VariableDeclarator

java.lang.Object
  |
  +--openjava.ptree.ParseTreeObject
        |
        +--openjava.ptree.NonLeaf
              |
              +--openjava.ptree.VariableDeclarator
All Implemented Interfaces:
Cloneable, ParseTree

public class VariableDeclarator
extends NonLeaf

The VariableDeclarator class presents variable declarator node of parse tree

See Also:
NonLeaf, VariableInitializer

Field Summary
(package private)  int dims
           
 
Fields inherited from class openjava.ptree.NonLeaf
 
Fields inherited from class openjava.ptree.ParseTreeObject
debugFlag, debugLevel, LN, out, writerStack
 
Constructor Summary
(package private) VariableDeclarator()
           
  VariableDeclarator(String declname, int dims, VariableInitializer varinit)
          Allocates a new object.
  VariableDeclarator(String declname, VariableInitializer varinit)
          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.
 String dimensionString()
           
 int getDimension()
           
 VariableInitializer getInitializer()
          Gets variable initializer.
 String getVariable()
          Gets declarator name, declarator name includes variable name but its dimension.
 void setInitializer(VariableInitializer vinit)
          Sets variable initializer.
 void setVariable(String name)
          Sets declarator name, declarator name includes variable name but its dimension.
 void writeCode()
          write code String "=" VaraiableInitializer
 
Methods inherited from class openjava.ptree.NonLeaf
childrenAccept, childrenAreEqual, elementAt, equals, getComment, getContents, getLength, getRowType, makeRecursiveCopy, replaceChildWith, set, set, set, set, set, set, set, set, set, setComment, setElementAt
 
Methods inherited from class openjava.ptree.ParseTreeObject
clone, eq, eq, equal, flushPrintWriter, getDebugFlag, getNest, getObjectID, getParent, getPrintWriter, getTab, hashCode, lastObjectID, makeCopy, popNest, popPrintWriter, pushNest, pushPrintWriter, replace, setDebugFlag, setDebugLevel, setNest, setParent, setPrintStream, setTab, toFlattenString, toString, 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.ParseTree
eq, getObjectID, makeCopy, replace, toFlattenString, toString
 

Field Detail

dims

int dims
Constructor Detail

VariableDeclarator

public VariableDeclarator(String declname,
                          int dims,
                          VariableInitializer varinit)
Allocates a new object.

Parameters:
declname - the declarator name.
varinit - the variable initializer.

VariableDeclarator

public VariableDeclarator(String declname,
                          VariableInitializer varinit)
Allocates a new object.

Parameters:
declname - the declarator name.
varinit - the variable initializer.

VariableDeclarator

VariableDeclarator()
Method Detail

writeCode

public void writeCode()
write code String "=" VaraiableInitializer

Specified by:
writeCode in interface ParseTree
Overrides:
writeCode in class NonLeaf

getVariable

public String getVariable()
Gets declarator name, declarator name includes variable name but its dimension.

Returns:
declarator name

setVariable

public void setVariable(String name)
Sets declarator name, declarator name includes variable name but its dimension.

Parameters:
name - declarator name to set.
See Also:
TypeName

getDimension

public int getDimension()

dimensionString

public String dimensionString()

getInitializer

public VariableInitializer getInitializer()
Gets variable initializer.

Returns:
variable initializer.

setInitializer

public void setInitializer(VariableInitializer vinit)
Sets variable initializer.

Parameters:
vinit - the variable initializer to set.

accept

public void accept(ParseTreeVisitor v)
            throws ParseTreeException
Description copied from interface: ParseTree
Accepts a 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.

Specified by:
accept in interface ParseTree
Specified by:
accept in class ParseTreeObject
Parameters:
v - a visitor
ParseTreeException

SourceForge.net_Logo