org.fife.rsta.ac.java.rjc.ast
Class AbstractTypeDeclarationNode

java.lang.Object
  extended by org.fife.rsta.ac.java.rjc.ast.AbstractTypeDeclarationNode
All Implemented Interfaces:
ASTNode, TypeDeclaration, TypeDeclarationContainer
Direct Known Subclasses:
EnumDeclaration, NormalClassDeclaration, NormalInterfaceDeclaration

public abstract class AbstractTypeDeclarationNode
extends Object
implements TypeDeclaration


Constructor Summary
AbstractTypeDeclarationNode(String name, Offset start)
           
AbstractTypeDeclarationNode(String name, Offset start, Offset end)
           
 
Method Summary
 void addMember(Member member)
           
 void addTypeDeclaration(TypeDeclaration type)
           
 boolean getBodyContainsOffset(int offs)
           
 int getBodyEndOffset()
           
 int getBodyStartOffset()
           
 TypeDeclaration getChildType(int index)
           
 TypeDeclaration getChildTypeAtOffset(int offs)
          Returns the child type declaration of this one that contains the specified offset, if any.
 int getChildTypeCount()
           
 String getDocComment()
           
 Iterator getFieldIterator()
          Returns an iterator over all fields defined in this type.
 Member getMember(int index)
           
 int getMemberCount()
           
 Iterator getMemberIterator()
          Returns an iterator over all members of this type.
 Iterator getMethodIterator()
          Returns an iterator over all methods defined in this type.
 List getMethodsByName(String name)
          Returns all methods declared in this type with the given name.
 Modifiers getModifiers()
           
 String getName()
          Returns the "name" of this node.
 int getNameEndOffset()
          Returns the end offset of the "name" of this node.
 int getNameStartOffset()
          Returns the start offset of the "name" of this node.
 Package getPackage()
          Returns the package this type is in.
 boolean isDeprecated()
           
 void setBodyEndOffset(Offset end)
           
 void setBodyStartOffset(Offset start)
           
 void setDeclarationEndOffset(Offset end)
           
protected  void setDeclarationOffsets(Offset start, Offset end)
          Sets the start and end offsets of this node.
 void setDeprecated(boolean deprecated)
           
 void setDocComment(String comment)
           
 void setModifiers(Modifiers modifiers)
           
 void setPackage(Package pkg)
          Sets the package this type is in.
 String toString()
          Returns the name of this node (e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.fife.rsta.ac.java.rjc.ast.TypeDeclaration
getName, getTypeString
 
Methods inherited from interface org.fife.rsta.ac.java.rjc.ast.ASTNode
getNameEndOffset, getNameStartOffset
 

Constructor Detail

AbstractTypeDeclarationNode

public AbstractTypeDeclarationNode(String name,
                                   Offset start)

AbstractTypeDeclarationNode

public AbstractTypeDeclarationNode(String name,
                                   Offset start,
                                   Offset end)
Method Detail

addMember

public void addMember(Member member)

addTypeDeclaration

public void addTypeDeclaration(TypeDeclaration type)
Specified by:
addTypeDeclaration in interface TypeDeclarationContainer

getBodyContainsOffset

public boolean getBodyContainsOffset(int offs)
Specified by:
getBodyContainsOffset in interface TypeDeclaration

getBodyEndOffset

public int getBodyEndOffset()
Specified by:
getBodyEndOffset in interface TypeDeclaration

getBodyStartOffset

public int getBodyStartOffset()
Specified by:
getBodyStartOffset in interface TypeDeclaration

getChildType

public TypeDeclaration getChildType(int index)
Specified by:
getChildType in interface TypeDeclaration

getChildTypeAtOffset

public TypeDeclaration getChildTypeAtOffset(int offs)
Returns the child type declaration of this one that contains the specified offset, if any.

Specified by:
getChildTypeAtOffset in interface TypeDeclaration
Parameters:
offs - The offset.
Returns:
The type declaration, or null if the offset is outside of any child type declaration.

getChildTypeCount

public int getChildTypeCount()
Specified by:
getChildTypeCount in interface TypeDeclaration

getDocComment

public String getDocComment()
Specified by:
getDocComment in interface TypeDeclaration

getFieldIterator

public Iterator getFieldIterator()
Returns an iterator over all fields defined in this type.

Specified by:
getFieldIterator in interface TypeDeclaration
Returns:
The iterator.
See Also:
TypeDeclaration.getMethodIterator(), TypeDeclaration.getMemberIterator()

getMember

public Member getMember(int index)

getMemberCount

public int getMemberCount()
Specified by:
getMemberCount in interface TypeDeclaration

getMemberIterator

public Iterator getMemberIterator()
Returns an iterator over all members of this type. Note that an exception may be thrown if a method is added to this type while this iterator is being used.

Specified by:
getMemberIterator in interface TypeDeclaration
Returns:
The iterator.
See Also:
TypeDeclaration.getMethodIterator()

getMethodIterator

public Iterator getMethodIterator()
Returns an iterator over all methods defined in this type.

Specified by:
getMethodIterator in interface TypeDeclaration
Returns:
The iterator.
See Also:
TypeDeclaration.getFieldIterator(), TypeDeclaration.getMemberIterator()

getMethodsByName

public List getMethodsByName(String name)
Returns all methods declared in this type with the given name. Does not check for methods with this name in subclasses.

Specified by:
getMethodsByName in interface TypeDeclaration
Parameters:
name - The name to check for.
Returns:
Any method overloads with that name, or an empty list if none.

getModifiers

public Modifiers getModifiers()
Specified by:
getModifiers in interface TypeDeclaration

getPackage

public Package getPackage()
Returns the package this type is in.

Specified by:
getPackage in interface TypeDeclaration
Returns:
The package, or null if it's in the default package.

isDeprecated

public boolean isDeprecated()
Specified by:
isDeprecated in interface TypeDeclaration

setBodyEndOffset

public void setBodyEndOffset(Offset end)

setBodyStartOffset

public void setBodyStartOffset(Offset start)

setDeprecated

public void setDeprecated(boolean deprecated)

setDocComment

public void setDocComment(String comment)
Specified by:
setDocComment in interface TypeDeclaration

setModifiers

public void setModifiers(Modifiers modifiers)

setPackage

public void setPackage(Package pkg)
Sets the package this type is in.

Parameters:
pkg - The package, or null if this is in the default package.
See Also:
getPackage()

toString

public String toString()
Returns the name of this node (e.g. the value of getName()). Subclasses can override this method if appropriate.

Returns:
A string representation of this node.

getName

public String getName()
Returns the "name" of this node. This will be the name of the method, the name of the member or local variable, etc. For CodeBlocks it will be CodeBlock.NAME.

Note that this may not be unique. For example, a class with an overloaded method will have multiple methods with the same "name," just with different signatures.

Specified by:
getName in interface ASTNode
Returns:
The "name" of this node.

getNameEndOffset

public int getNameEndOffset()
Returns the end offset of the "name" of this node.

Specified by:
getNameEndOffset in interface ASTNode
Returns:
The end offset.

getNameStartOffset

public int getNameStartOffset()
Returns the start offset of the "name" of this node.

Specified by:
getNameStartOffset in interface ASTNode
Returns:
The start offset.

setDeclarationEndOffset

public void setDeclarationEndOffset(Offset end)

setDeclarationOffsets

protected void setDeclarationOffsets(Offset start,
                                     Offset end)
Sets the start and end offsets of this node.

Parameters:
start - The start offset.
end - The end offset.


Copyright © 2003-2011. All Rights Reserved.