public abstract class AstNode extends com.strobel.core.Freezable implements INode, com.strobel.componentmodel.UserDataStore, java.lang.Cloneable
| Modifier and Type | Field and Description |
|---|---|
protected static int |
AST_NODE_USED_FLAGS |
protected int |
flags |
static AstNode |
NULL |
CHILD_ITERATOR| Modifier | Constructor and Description |
|---|---|
protected |
AstNode() |
| Modifier and Type | Method and Description |
|---|---|
abstract <T,R> R |
acceptVisitor(IAstVisitor<? super T,? extends R> visitor,
T data) |
<T extends AstNode> |
addChild(T child,
Role<T> role) |
AstNode |
clone() |
boolean |
contains(int line,
int column) |
boolean |
contains(TextLocation location) |
void |
copyUserDataFrom(AstNode source) |
static AstNode |
forPattern(Pattern pattern) |
protected void |
freezeCore() |
java.lang.Iterable<AstNode> |
getAncestors() |
<T extends AstNode> |
getAncestors(java.lang.Class<T> type) |
java.lang.Iterable<AstNode> |
getAncestorsAndSelf() |
<T extends AstNode> |
getChildByRole(Role<T> role) |
java.lang.Iterable<AstNode> |
getChildren() |
<T extends AstNode> |
getChildrenByRole(Role<T> role) |
java.lang.Iterable<AstNode> |
getDescendants() |
java.lang.Iterable<AstNode> |
getDescendantsAndSelf() |
TextLocation |
getEndLocation() |
AstNode |
getFirstChild() |
AstNode |
getLastChild() |
AstNode |
getNextNode() |
AstNode |
getNextSibling() |
<T extends AstNode> |
getNextSibling(Role<T> role) |
abstract NodeType |
getNodeType() |
AstNode |
getParent() |
<T extends AstNode> |
getParent(java.lang.Class<T> nodeType) |
AstNode |
getPreviousNode() |
AstNode |
getPreviousSibling() |
<T extends AstNode> |
getPreviousSibling(Role<T> role) |
Region |
getRegion() |
Role |
getRole() |
TextLocation |
getStartLocation() |
java.lang.String |
getText() |
java.lang.String |
getText(JavaFormattingOptions options) |
<T> T |
getUserData(com.strobel.componentmodel.Key<T> key) |
boolean |
hasChildren() |
<T extends AstNode> |
insertChildAfter(AstNode previousSibling,
T child,
Role<T> role) |
<T extends AstNode> |
insertChildBefore(AstNode nextSibling,
T child,
Role<T> role) |
<T extends AstNode> |
insertChildrenAfter(AstNode nextSibling,
Role<T> role,
T... children) |
<T extends AstNode> |
insertChildrenBefore(AstNode nextSibling,
Role<T> role,
T... children) |
boolean |
isAncestorOf(AstNode node) |
boolean |
isDescendantOf(AstNode node) |
boolean |
isInside(int line,
int column) |
boolean |
isInside(TextLocation location) |
static boolean |
isLoop(AstNode statement) |
boolean |
isNull() |
boolean |
isReference() |
static boolean |
isUnconditionalBranch(AstNode statement) |
Match |
match(INode other) |
boolean |
matches(INode other) |
abstract boolean |
matches(INode other,
Match match) |
boolean |
matchesCollection(Role role,
INode position,
Match match,
BacktrackingInfo backtrackingInfo) |
protected static boolean |
matchString(java.lang.String pattern,
java.lang.String text) |
<T> void |
putUserData(com.strobel.componentmodel.Key<T> key,
T value) |
<T> T |
putUserDataIfAbsent(com.strobel.componentmodel.Key<T> key,
T value) |
void |
remove() |
<T> boolean |
replace(com.strobel.componentmodel.Key<T> key,
T oldValue,
T newValue) |
void |
replaceWith(AstNode newNode) |
<T extends AstNode> |
replaceWith(com.strobel.functions.Function<? super AstNode,? extends T> replaceFunction) |
protected <T extends AstNode> |
setChildByRole(Role<T> role,
T newChild) |
void |
setRole(Role<?> role) |
java.lang.String |
toString() |
protected static final int AST_NODE_USED_FLAGS
protected int flags
public static final AstNode NULL
protected static boolean matchString(java.lang.String pattern,
java.lang.String text)
public static boolean isLoop(AstNode statement)
public static boolean isUnconditionalBranch(AstNode statement)
public abstract <T,R> R acceptVisitor(IAstVisitor<? super T,? extends R> visitor, T data)
public AstNode clone()
clone in class java.lang.Objectpublic void copyUserDataFrom(AstNode source)
public final AstNode getParent()
public final AstNode getPreviousSibling()
public final AstNode getLastChild()
public final AstNode getFirstChild()
getFirstChild in interface INodepublic final AstNode getNextSibling()
getNextSibling in interface INodepublic final boolean hasChildren()
public final AstNode getNextNode()
public final AstNode getPreviousNode()
public final java.lang.Iterable<AstNode> getChildren()
public final boolean isAncestorOf(AstNode node)
public final boolean isDescendantOf(AstNode node)
public final <T extends AstNode> java.lang.Iterable<T> getAncestors(@NotNull java.lang.Class<T> type)
public final java.lang.Iterable<AstNode> getAncestors()
public final java.lang.Iterable<AstNode> getAncestorsAndSelf()
public final java.lang.Iterable<AstNode> getDescendants()
public final java.lang.Iterable<AstNode> getDescendantsAndSelf()
@NotNull public final <T extends AstNode> AstNodeCollection<T> getChildrenByRole(Role<T> role)
public final <T extends AstNode> T getParent(java.lang.Class<T> nodeType)
@SafeVarargs public final <T extends AstNode> void insertChildrenBefore(AstNode nextSibling, Role<T> role, T... children)
public final <T extends AstNode> void insertChildBefore(AstNode nextSibling, T child, Role<T> role)
@SafeVarargs public final <T extends AstNode> void insertChildrenAfter(AstNode nextSibling, Role<T> role, T... children)
public final <T extends AstNode> void insertChildAfter(AstNode previousSibling, T child, Role<T> role)
public final void remove()
public final void replaceWith(AstNode newNode)
public final <T extends AstNode> T replaceWith(com.strobel.functions.Function<? super AstNode,? extends T> replaceFunction)
protected void freezeCore()
freezeCore in class com.strobel.core.Freezablepublic abstract NodeType getNodeType()
public boolean isReference()
public final void setRole(Role<?> role)
public boolean matchesCollection(Role role, INode position, Match match, BacktrackingInfo backtrackingInfo)
matchesCollection in interface INodepublic TextLocation getStartLocation()
public TextLocation getEndLocation()
public Region getRegion()
public final boolean contains(int line,
int column)
public final boolean contains(TextLocation location)
public final boolean isInside(int line,
int column)
public final boolean isInside(TextLocation location)
public java.lang.String getText()
public java.lang.String getText(JavaFormattingOptions options)
public java.lang.String toString()
toString in class java.lang.Objectpublic final <T> T getUserData(com.strobel.componentmodel.Key<T> key)
getUserData in interface com.strobel.componentmodel.UserDataStorepublic final <T> void putUserData(com.strobel.componentmodel.Key<T> key,
T value)
putUserData in interface com.strobel.componentmodel.UserDataStorepublic final <T> T putUserDataIfAbsent(com.strobel.componentmodel.Key<T> key,
T value)
putUserDataIfAbsent in interface com.strobel.componentmodel.UserDataStorepublic final <T> boolean replace(com.strobel.componentmodel.Key<T> key,
T oldValue,
T newValue)
replace in interface com.strobel.componentmodel.UserDataStore