com.jeffpalm.javaparser
Class ASTName

java.lang.Object
  extended by com.jeffpalm.javaparser.SimpleNode
      extended by com.jeffpalm.javaparser.ASTName
All Implemented Interfaces:
Node, java.lang.Cloneable
Direct Known Subclasses:
ASTClassOrInterfaceType, ASTGenericDeclaration, ASTGenericDeclarationPart, ASTTypeParameter

public class ASTName
extends SimpleNode
implements java.lang.Cloneable

Stores a name. The name can consist of a number of parts separated by periods. The name consists of parts which are stored as ASTIdentifier nodes in this objects children.

Since:
jRefactory 2.9.0, created October 16, 2003
Author:
Mike Atkinson

Field Summary
protected  java.lang.String name
          The cached value of the name.
 
Fields inherited from class com.jeffpalm.javaparser.SimpleNode
children, id, parent, parser, specials
 
Constructor Summary
ASTName()
          Constructor for the ASTName node.
ASTName(int identifier)
          Constructor for the ASTName node.
ASTName(JavaParser parser, int identifier)
          Constructor for the ASTName node.
 
Method Summary
 void addNamePart(java.lang.String newName)
          Set the node's name
 ASTName changeStartingPart(ASTName oldBase, ASTName newBase)
          Change starting part.
 boolean equals(java.lang.Object other)
          Checks to see if the two names are equal
 void fromString(java.lang.String input)
          Convert this object from a string
 java.lang.String getName()
          Get the node's name
 java.lang.String getNamePart(int ndx)
          Add a component of the name
 int getNameSize()
          Get the length of the name
 int hashCode()
          Computes a hash value for this node.
 void insertNamePart(int ndx, java.lang.String value)
          Add a component of the name
 java.lang.Object jjtAccept(JavaParserVisitor visitor, java.lang.Object data)
          Accept the visitor.
 void setImage(java.lang.String image)
          Convert this object from a string (used for PMD testing)
 void setNamePart(int ndx, java.lang.String value)
          Add a component of the name
 boolean startsWith(ASTName otherName)
          Determines if two names start with the same series of items
 
Methods inherited from class com.jeffpalm.javaparser.SimpleNode
addSpecial, childrenAccept, dump, dumpString, findChildrenOfType, findChildrenOfType, findChildrenOfType, getBeginColumn, getBeginLine, getEndColumn, getEndLine, getImage, getScope, getSpecial, hasAnyChildren, init, isRequired, jjtAddChild, jjtAddFirstChild, jjtClose, jjtDeleteChild, jjtGetChild, jjtGetFirstChild, jjtGetID, jjtGetNumChildren, jjtGetParent, jjtInsertChild, jjtOpen, jjtSetParent, printModifiers, removeSpecial, setLineAndColumnInfo, setScope, testingOnly__setBeginColumn, testingOnly__setBeginLine, toString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The cached value of the name.

Constructor Detail

ASTName

public ASTName()
Constructor for the ASTName node.


ASTName

public ASTName(int identifier)
Constructor for the ASTName node.

Parameters:
identifier - The id of this node (JJTNAME).

ASTName

public ASTName(JavaParser parser,
               int identifier)
Constructor for the ASTName node.

Parameters:
parser - The JavaParser that created this ASTName node.
identifier - The id of this node (JJTNAME).
Method Detail

setNamePart

public void setNamePart(int ndx,
                        java.lang.String value)
Add a component of the name

Parameters:
ndx - the index of the part requested
value - The new NamePart value

setImage

public void setImage(java.lang.String image)
Convert this object from a string (used for PMD testing)

Parameters:
image - The name in form "org.test.AName" for example

getNamePart

public java.lang.String getNamePart(int ndx)
Add a component of the name

Parameters:
ndx - the index of the part requested
Returns:
the portion of the name requested

getName

public java.lang.String getName()
Get the node's name

Overrides:
getName in class SimpleNode
Returns:
the name

getNameSize

public int getNameSize()
Get the length of the name

Returns:
the number of parts in the name

insertNamePart

public void insertNamePart(int ndx,
                           java.lang.String value)
Add a component of the name

Parameters:
ndx - the index of the part requested
value - Description of Parameter

addNamePart

public void addNamePart(java.lang.String newName)
Set the node's name

Parameters:
newName - the new name

fromString

public void fromString(java.lang.String input)
Convert this object from a string

Parameters:
input - Description of Parameter

equals

public boolean equals(java.lang.Object other)
Checks to see if the two names are equal

Overrides:
equals in class java.lang.Object
Parameters:
other - Description of Parameter
Returns:
Description of the Returned Value

hashCode

public int hashCode()
Computes a hash value for this node.

Overrides:
hashCode in class java.lang.Object
Returns:
The hash value for this node.

startsWith

public boolean startsWith(ASTName otherName)
Determines if two names start with the same series of items

Parameters:
otherName - Description of Parameter
Returns:
Description of the Returned Value

changeStartingPart

public ASTName changeStartingPart(ASTName oldBase,
                                  ASTName newBase)
Change starting part. Presumes that otherName is less than the length of the current name.

Parameters:
oldBase - Description of Parameter
newBase - Description of Parameter
Returns:
Description of the Returned Value

jjtAccept

public java.lang.Object jjtAccept(JavaParserVisitor visitor,
                                  java.lang.Object data)
Accept the visitor.

Specified by:
jjtAccept in interface Node
Overrides:
jjtAccept in class SimpleNode
Parameters:
visitor - An implementation of JavaParserVisitor that processes the ASTName node.
data - Some data being passed between the visitor methods.
Returns:
Usually the data parameter (possibly modified).