|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.fife.rsta.ac.java.rjc.ast.CodeBlock
public class CodeBlock
A block of code in curly braces in a class.
This class implements the Member interface because a block
can be a member (say, a static block in a class declaration), but usually
it's not actually a Member, but something else, e.g. the body
of a method, or the content of an if-statement, etc.
| Field Summary | |
|---|---|
static String |
NAME
The name of all CodeBlocks. |
| Constructor Summary | |
|---|---|
CodeBlock(boolean isStatic,
Offset startOffs)
|
|
| Method Summary | |
|---|---|
void |
add(CodeBlock child)
|
void |
addLocalVariable(LocalVariable localVar)
|
boolean |
containsOffset(int offs)
|
CodeBlock |
getChildBlock(int index)
|
int |
getChildBlockCount()
|
CodeBlock |
getDeepestCodeBlockContaining(int offs)
Returns the deepest code block nested under this one (or this one itself) containing a given offset. |
String |
getDocComment()
|
LocalVariable |
getLocalVar(int index)
|
int |
getLocalVarCount()
|
List |
getLocalVarsBefore(int offs)
Returns all local variables declared before a given offset, both in this code block and in all parent blocks. |
Modifiers |
getModifiers()
Always returns an empty modifiers instance, since blocks don't have modifiers. |
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. |
CodeBlock |
getParent()
|
TypeDeclaration |
getParentTypeDeclaration()
|
Type |
getType()
Returns null, since blocks don't have types. |
boolean |
isDeprecated()
|
boolean |
isStatic()
Returns whether this block is a static block (in a class declaration). |
void |
setDeclarationEndOffset(Offset end)
|
protected void |
setDeclarationOffsets(Offset start,
Offset end)
Sets the start and end offsets of this node. |
void |
setParent(CodeBlock parent)
|
void |
setParentTypeDeclaration(TypeDeclaration dec)
|
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.Member |
|---|
getName, getNameEndOffset, getNameStartOffset |
| Field Detail |
|---|
public static final String NAME
CodeBlocks.
| Constructor Detail |
|---|
public CodeBlock(boolean isStatic,
Offset startOffs)
| Method Detail |
|---|
public void add(CodeBlock child)
public void addLocalVariable(LocalVariable localVar)
public boolean containsOffset(int offs)
public CodeBlock getChildBlock(int index)
public int getChildBlockCount()
public CodeBlock getDeepestCodeBlockContaining(int offs)
offs - The offset to look for.
null if this code block and none of its children
contain the offset.public String getDocComment()
public LocalVariable getLocalVar(int index)
public int getLocalVarCount()
public List getLocalVarsBefore(int offs)
offs - The offset.
LocalVariables, or an empty list of none were
declared before the offset.public Modifiers getModifiers()
public CodeBlock getParent()
public Type getType()
null, since blocks don't have types.
null always.public boolean isDeprecated()
public boolean isStatic()
public void setParent(CodeBlock parent)
public TypeDeclaration getParentTypeDeclaration()
getParentTypeDeclaration in interface Memberpublic void setParentTypeDeclaration(TypeDeclaration dec)
setParentTypeDeclaration in interface Memberpublic String getName()
CodeBlocks
it will be 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.
getName in interface ASTNodepublic int getNameEndOffset()
getNameEndOffset in interface ASTNodepublic int getNameStartOffset()
getNameStartOffset in interface ASTNodepublic void setDeclarationEndOffset(Offset end)
protected void setDeclarationOffsets(Offset start,
Offset end)
start - The start offset.end - The end offset.public String toString()
getName()).
Subclasses can override this method if appropriate.
toString in class Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||