openjava.ptree
Class TypeName

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

public class TypeName
extends NonLeaf

The TypeName class represents a type specifier node of parse tree.

See Also:
ParseTree, NonLeaf

Fields inherited from class openjava.ptree.ParseTreeObject
debugFlag, debugLevel, LN, out, writerStack
 
Constructor Summary
TypeName(java.lang.String typename)
          Allocates a new object.
TypeName(java.lang.String typename, java.util.Hashtable suffixes)
          Allocates a new object.
TypeName(java.lang.String typename, int n)
          Allocates a new object.
TypeName(java.lang.String typename, int n, java.util.Hashtable suffixes)
           
 
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. This invoke an appropriate visit() method on the accepted visitor.
 void addDimension(int n)
           
 void addDimension(java.lang.String dimstr)
           
static TypeName forOJClass(OJClass clazz)
           
 int getDimension()
          Gets array dimension of declarated type
 java.lang.String getName()
          Gets the type name of this type specifier.
 ParseTree makeCopy()
          Makes a new copy of this nonleaf-node as a ptree-node.
 ParseTree makeRecursiveCopy()
          Makes a new copy (another object) of this nonleaf-node recursively.
 void setDimension(int n)
          Sets array dimension of declarated type
 void setName(java.lang.String name)
          Sets the type name except array dimension of this type specifier.
 void setTypeName(java.lang.String typename)
          Deprecated.  
static java.lang.String stringFromDimension(int dimension)
           
static int toDimension(java.lang.String typename)
           
 void writeCode()
          Writes the code this parse-tree presents for.
 
Methods inherited from class openjava.ptree.NonLeaf
childrenAccept, elementAt, equals, getComment, getContents, getLength, 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, 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, replace, toFlattenString, toString
 

Constructor Detail

TypeName

public TypeName(java.lang.String typename,
                int n,
                java.util.Hashtable suffixes)

TypeName

public TypeName(java.lang.String typename,
                int n)
Allocates a new object.
Parameters:
typename - type name
n - array dimension

TypeName

public TypeName(java.lang.String typename,
                java.util.Hashtable suffixes)
Allocates a new object.
Parameters:
typename - type name
n - array dimension

TypeName

public TypeName(java.lang.String typename)
Allocates a new object. No array dimension will set.
     new TypeName( typename )
 

equals:
     new TypeName( typename, 0 )
 

Parameters:
typename - type name
Method Detail

forOJClass

public static TypeName forOJClass(OJClass clazz)

makeRecursiveCopy

public ParseTree makeRecursiveCopy()
Description copied from class: NonLeaf
Makes a new copy (another object) of this nonleaf-node recursively. The objects contained by this object will also be copied.
Overrides:
makeRecursiveCopy in class NonLeaf
Following copied from class: openjava.ptree.NonLeaf
Returns:
the copy of this nonleaf-node as a ptree-node.

makeCopy

public ParseTree makeCopy()
Description copied from interface: ParseTree
Makes a new copy of this nonleaf-node as a ptree-node. The objects contained by the new object are same as these contained by the original object.
Overrides:
makeCopy in class ParseTreeObject
Following copied from interface: openjava.ptree.ParseTree
Returns:
the copy of this nonleaf-node as a ptree-node.

writeCode

public void writeCode()
Description copied from class: NonLeaf
Writes the code this parse-tree presents for.
Overrides:
writeCode in class NonLeaf

getDimension

public int getDimension()
Gets array dimension of declarated type
Returns:
array dimension

setDimension

public void setDimension(int n)
Sets array dimension of declarated type
Parameters:
dim - array dimension

addDimension

public void addDimension(int n)

addDimension

public void addDimension(java.lang.String dimstr)

getName

public java.lang.String getName()
Gets the type name of this type specifier.
Returns:
the type name.

setTypeName

public void setTypeName(java.lang.String typename)
Deprecated.  

Sets the type name of this type specifier.
Parameters:
typename - the type name to set.
See Also:
setName(String)

setName

public void setName(java.lang.String name)
Sets the type name except array dimension of this type specifier.
Parameters:
name - the type name to set.

stringFromDimension

public static java.lang.String stringFromDimension(int dimension)

toDimension

public static int toDimension(java.lang.String typename)

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.

Overrides:
accept in class ParseTreeObject
Following copied from interface: openjava.ptree.ParseTree
Parameters:
visitor - a visitor