public abstract class Node extends Object implements Cloneable
Modifier and Type | Field and Description |
---|---|
static int |
ABSOLUTE_BEGIN_LINE |
static int |
ABSOLUTE_END_LINE |
Modifier and Type | Method and Description |
---|---|
abstract <R,A> R |
accept(GenericVisitor<R,A> v,
A arg)
Accept method for visitor support.
|
abstract <A> void |
accept(VoidVisitor<A> v,
A arg)
Accept method for visitor support.
|
void |
addOrphanComment(Comment comment) |
Node |
clone() |
boolean |
contains(Node other) |
boolean |
equals(Object obj) |
List<Comment> |
getAllContainedComments()
This is the list of Comment which are contained in the Node either because
they are properly associated to one of its children or because they are floating
around inside the Node
|
Position |
getBegin()
The begin position of this node in the source file.
|
List<Node> |
getChildrenNodes() |
Comment |
getComment()
This is a comment associated with this node.
|
Object |
getData()
Use this to retrieve additional information associated to this node.
|
Position |
getEnd()
The end position of this node in the source file.
|
<N extends Node> |
getNodesByType(Class<N> clazz)
Recursively finds all nodes of a certain type.
|
List<Comment> |
getOrphanComments()
This is a list of Comment which are inside the node and are not associated
with any meaningful AST Node.
|
Node |
getParentNode() |
<T> T |
getParentNodeOfType(Class<T> classType) |
Range |
getRange() |
boolean |
hasComment() |
int |
hashCode() |
boolean |
isPositionedAfter(Position position) |
boolean |
isPositionedBefore(Position position) |
protected void |
setAsParentNodeOf(List<? extends Node> childNodes) |
protected void |
setAsParentNodeOf(Node childNode) |
void |
setBegin(Position begin)
Sets the begin position of this node in the source file.
|
void |
setBlockComment(String comment)
Use this to store additional information to this node.
|
void |
setComment(Comment comment)
Use this to store additional information to this node.
|
void |
setData(Object data)
Use this to store additional information to this node.
|
void |
setEnd(Position end)
Sets the end position of this node in the source file.
|
void |
setLineComment(String comment)
Use this to store additional information to this node.
|
void |
setParentNode(Node parentNode)
Assign a new parent to this node, removing it
from the list of children of the previous parent, if any.
|
void |
setRange(Range range) |
String |
toString()
Return the String representation of this node.
|
String |
toStringWithoutComments() |
void |
tryAddImportToParentCompilationUnit(Class<?> clazz) |
public static final int ABSOLUTE_BEGIN_LINE
public static final int ABSOLUTE_END_LINE
public Node()
public Node(Range range)
public abstract <R,A> R accept(GenericVisitor<R,A> v, A arg)
R
- the type the return value of the visitorA
- the type the argument passed to the visitorv
- the visitor implementationarg
- the argument passed to the visitorpublic abstract <A> void accept(VoidVisitor<A> v, A arg)
A
- the type the argument passed for the visitorv
- the visitor implementationarg
- any value relevant for the visitorpublic final Comment getComment()
public final Object getData()
public Position getBegin()
public Position getEnd()
public void setBegin(Position begin)
public void setEnd(Position end)
public Range getRange()
public void setRange(Range range)
range
- the range of characters in the source code that this node covers.public final void setComment(Comment comment)
comment
- to be setpublic final void setLineComment(String comment)
comment
- to be setpublic final void setBlockComment(String comment)
comment
- to be setpublic final void setData(Object data)
data
- to be setpublic final String toString()
public final String toStringWithoutComments()
public Node getParentNode()
public <T> T getParentNodeOfType(Class<T> classType)
public boolean contains(Node other)
public void addOrphanComment(Comment comment)
public List<Comment> getOrphanComments()
public List<Comment> getAllContainedComments()
public void setParentNode(Node parentNode)
parentNode
- node to be set as parentprotected void setAsParentNodeOf(Node childNode)
public boolean isPositionedAfter(Position position)
public boolean isPositionedBefore(Position position)
public boolean hasComment()
public void tryAddImportToParentCompilationUnit(Class<?> clazz)
Copyright © 2007–2016. All rights reserved.