openjava.ptree
Class TypeName

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

public class TypeName
extends NonLeaf

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

See Also:
ParseTree, NonLeaf

Field Summary
(package private)  int dim
           
(package private)  Hashtable suffixes
           
 
Fields inherited from class openjava.ptree.NonLeaf
 
Fields inherited from class openjava.ptree.ParseTreeObject
debugFlag, debugLevel, LN, out, writerStack
 
Constructor Summary
(package private) TypeName()
           
  TypeName(String typename)
          Allocates a new object.
  TypeName(String typename, Hashtable suffixes)
          Allocates a new object.
  TypeName(String typename, int n)
          Allocates a new object.
  TypeName(String typename, int n, 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.
 void addDimension(int n)
           
 void addDimension(String dimstr)
           
static TypeName forClass(Class clazz)
           
static TypeName forOJClass(OJClass clazz)
           
 int getDimension()
          Gets array dimension of declarated type
 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(String name)
          Sets the type name except array dimension of this type specifier.
 void setTypeName(String typename)
          Deprecated.  
static String stringFromDimension(int dimension)
           
static int toDimension(String typename)
           
 void writeCode()
          Writes the code this parse-tree presents for.
 
Methods inherited from class openjava.ptree.NonLeaf
childrenAccept, childrenAreEqual, elementAt, equals, getComment, getContents, getLength, getRowType, 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
 

Field Detail

suffixes

Hashtable suffixes

dim

int dim
Constructor Detail

TypeName

public TypeName(String typename,
                int n,
                Hashtable suffixes)

TypeName

public TypeName(String typename,
                int n)
Allocates a new object.

Parameters:
typename - type name
n - array dimension

TypeName

public TypeName(String typename,
                Hashtable suffixes)
Allocates a new object.

Parameters:
typename - type name

TypeName

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

equals:
     new TypeName( typename, 0 )
 

Parameters:
typename - type name

TypeName

TypeName()
Method Detail

forOJClass

public static TypeName forOJClass(OJClass clazz)

forClass

public static TypeName forClass(Class 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.

Specified by:
makeRecursiveCopy in interface ParseTree
Overrides:
makeRecursiveCopy in class 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.

Specified by:
makeCopy in interface ParseTree
Overrides:
makeCopy in class ParseTreeObject
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.

Specified by:
writeCode in interface ParseTree
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


addDimension

public void addDimension(int n)

addDimension

public void addDimension(String dimstr)

getName

public String getName()
Gets the type name of this type specifier.

Returns:
the type name.

setTypeName

public void setTypeName(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(String name)
Sets the type name except array dimension of this type specifier.

Parameters:
name - the type name to set.

stringFromDimension

public static String stringFromDimension(int dimension)

toDimension

public static int toDimension(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.

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

SourceForge.net_Logo