|
Jalopy 1.0b10 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--de.hunsicker.antlr.BaseAST | +--de.hunsicker.antlr.CommonAST | +--de.hunsicker.antlr.CommonASTWithHiddenTokens | +--de.hunsicker.jalopy.language.Node | +--de.hunsicker.jalopy.language.JavaNode
A node representing an element in a Java source file.
Field Summary | |
protected JavaNode |
parent
Parent node. |
protected JavaNode |
prevSibling
Previous node. |
Fields inherited from class de.hunsicker.jalopy.language.Node |
endColumn, endLine, startColumn, startLine, text, type |
Fields inherited from class de.hunsicker.antlr.CommonASTWithHiddenTokens |
hiddenAfter, hiddenBefore |
Fields inherited from class de.hunsicker.antlr.BaseAST |
down, right |
Constructor Summary | |
JavaNode()
Creates a new JavaNode object. |
|
JavaNode(int startLine,
int startColumn,
int endLine,
int endColumn)
Creates a new JavaNode object. |
|
JavaNode(int type,
String text)
Creates a new JavaNode object. |
|
JavaNode(Token tok)
Creates a new JavaNode object from the given token. |
Method Summary | |
void |
addChild(AST node)
Adds a node to the end of the child list for this node. |
void |
attachAnnotation(Annotation annotation)
Attaches an annotation to this node. |
List |
detachAnnotations()
Detaches and returns all annotations that are attached to this node. |
CommonHiddenStreamToken |
getCommentAfter()
Returns the first comment that appears after this node. |
CommonHiddenStreamToken |
getCommentBefore()
Returns the first comment before this node. |
JavaNode |
getParent()
Returns the parent node of this node. |
Position |
getPosition()
Gets the tracked position. |
JavaNode |
getPreviousSibling()
Returns the previous sibling of this node. |
int |
getSizeCommentsAfter()
Returns the number of comments that appear after this node. |
int |
getSizeCommentsBefore()
Returns the number of comments that appear before this node. |
boolean |
hasCommentsAfter()
Indicates whether comments appear before of this node. |
boolean |
hasCommentsBefore()
Indicates whether comments appear after this node. |
boolean |
hasJavadocComment()
Indicates whether this node has a Javadoc comment attached. |
void |
initialize(AST node)
{@inheritDoc} |
void |
setParent(JavaNode node)
Sets the parent to the given node. |
void |
setPosition(Position position)
Sets the position that is to be tracked. |
void |
setPreviousSibling(JavaNode node)
Sets the previous sibling to the given node. |
String |
toString()
{@inheritDoc} |
void |
updatePosition(int line,
int column)
Updates the position information of this node (and all annotations), if necessary. |
Methods inherited from class de.hunsicker.jalopy.language.Node |
compareTo, contains, contains, contains, endsAfter, equals, getEndColumn, getEndLine, getStartColumn, getStartLine, getText, getType, initialize, initialize, isPositionKnown, setEndColumn, setEndLine, setHiddenAfter, setHiddenBefore, setStartColumn, setStartLine, setText, setType, startsBefore |
Methods inherited from class de.hunsicker.antlr.CommonASTWithHiddenTokens |
getHiddenAfter, getHiddenBefore |
Methods inherited from class de.hunsicker.antlr.BaseAST |
decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected JavaNode parent
protected JavaNode prevSibling
Constructor Detail |
public JavaNode(int startLine, int startColumn, int endLine, int endColumn)
startLine
- the starting line.startColumn
- the starting column offset.endLine
- the ending line.endColumn
- the ending column offset.public JavaNode()
public JavaNode(Token tok)
tok
- token to initialize the node with.public JavaNode(int type, String text)
type
- the type of the node.text
- the text of the node.Method Detail |
public CommonHiddenStreamToken getCommentAfter()
null
if no comments appear after this node.public CommonHiddenStreamToken getCommentBefore()
null
if this node
does not have a comment before.public void setParent(JavaNode node)
node
- a node.public JavaNode getParent()
public void setPosition(Position position)
position
- position to track.updatePosition(int, int)
public Position getPosition()
null
if no position was set.public void setPreviousSibling(JavaNode node)
node
- a node.public JavaNode getPreviousSibling()
public int getSizeCommentsAfter()
public int getSizeCommentsBefore()
public void addChild(AST node)
addChild
in class BaseAST
node
- node to add as a new child.public void attachAnnotation(Annotation annotation)
annotation
- annotation.public List detachAnnotations()
<Annotation>
). Returns an
empty list in case no annotations were found.public boolean hasCommentsAfter()
true
if comments appear before this node.public boolean hasCommentsBefore()
true
if comments follows this node.public boolean hasJavadocComment()
true
if this node has a Javadoc comment attached.public void initialize(AST node)
initialize
in class Node
de.hunsicker.jalopy.language.Node
node
- node to setup this node with.public String toString()
toString
in class Node
de.hunsicker.jalopy.language.Node
public void updatePosition(int line, int column)
line
- the new line information.column
- the new column offset information.setPosition(de.hunsicker.jalopy.language.Position)
,
attachAnnotation(de.hunsicker.jalopy.language.Annotation)
|
Jalopy 1.0b10 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |