public class JavaNode extends Node
Modifier and Type | Field and Description |
---|---|
protected JavaNode |
parent
Parent node.
|
protected JavaNode |
prevSibling
Previous node.
|
Constructor and Description |
---|
JavaNode()
Creates a new JavaNode object.
|
JavaNode(int startLine,
int startColumn,
int endLine,
int endColumn)
Creates a new JavaNode object.
|
JavaNode(int type,
java.lang.String text)
Creates a new JavaNode object.
|
JavaNode(de.hunsicker.antlr.Token tok)
Creates a new JavaNode object from the given token.
|
Modifier and Type | Method and Description |
---|---|
void |
addChild(de.hunsicker.antlr.collections.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.
|
java.util.List |
detachAnnotations()
Detaches and returns all annotations that are attached to this node.
|
de.hunsicker.antlr.CommonHiddenStreamToken |
getCommentAfter()
Returns the first comment that appears after this node.
|
de.hunsicker.antlr.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(de.hunsicker.antlr.collections.AST node)
Initializes this node with information from the given node.
|
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.
|
java.lang.String |
toString()
Returns a string representation of this node.
|
void |
updatePosition(int line,
int column)
Updates the position information of this node (and all annotations), if necessary.
|
compareTo, contains, contains, contains, endsAfter, equals, getEndColumn, getEndLine, getStartColumn, getStartLine, getText, getType, hashCode, initialize, initialize, isPositionKnown, setEndColumn, setEndLine, setHiddenAfter, setHiddenBefore, setStartColumn, setStartLine, setText, setType, startsBefore
getHiddenAfter, getHiddenBefore
decode, encode, equals, equalsList, equalsListPartial, equalsTree, equalsTreePartial, findAll, findAllPartial, getFirstChild, getNextSibling, removeChildren, setFirstChild, setNextSibling, setVerboseStringConversion, toStringList, toStringTree, xmlSerialize, xmlSerializeNode, xmlSerializeRootClose, xmlSerializeRootOpen
protected JavaNode parent
protected JavaNode prevSibling
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(de.hunsicker.antlr.Token tok)
tok
- token to initialize the node with.public JavaNode(int type, java.lang.String text)
type
- the type of the node.text
- the text of the node.public de.hunsicker.antlr.CommonHiddenStreamToken getCommentAfter()
null
if no comments appear after this node.public de.hunsicker.antlr.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(de.hunsicker.antlr.collections.AST node)
addChild
in interface de.hunsicker.antlr.collections.AST
addChild
in class de.hunsicker.antlr.BaseAST
node
- node to add as a new child.public void attachAnnotation(Annotation annotation)
annotation
- annotation.public java.util.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(de.hunsicker.antlr.collections.AST node)
initialize
in interface de.hunsicker.antlr.collections.AST
initialize
in class Node
node
- node to setup this node with.public java.lang.String toString()
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)
Submit a bug or feature.
For further information and documentation, visit the official Jalopy website.
This page generated: March 30 2013