Class AstNode
java.lang.Object
com.strobel.core.Freezable
com.strobel.decompiler.languages.java.ast.AstNode
- All Implemented Interfaces:
UserDataStore
,IFreezable
,INode
,Cloneable
- Direct Known Subclasses:
ArraySpecifier
,AstNode.NullAstNode
,AstNode.PatternPlaceholder
,AstType
,CaseLabel
,CatchClause
,Comment
,CompilationUnit
,EntityDeclaration
,Expression
,Identifier
,ImportDeclaration
,JavaTokenNode
,NewLineNode
,PackageDeclaration
,Statement
,SwitchExpressionArm
,SwitchSection
,TextNode
,TypeParameterDeclaration
,VariableInitializer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
private static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final UserDataStore
private AstNode
private AstNode
private AstNode
private AstNode
private AstNode
protected static final int
protected int
(package private) static final int
static final AstNode
(package private) static final int
Fields inherited from interface com.strobel.decompiler.patterns.INode
CHILD_ITERATOR
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract <T,
R> R acceptVisitor
(IAstVisitor<? super T, ? extends R> visitor, T data) final <T extends AstNode>
void(package private) final void
addChildUnsafe
(AstNode child, Role<?> role) clone()
final boolean
contains
(int line, int column) final boolean
contains
(TextLocation location) private static <T> void
void
copyUserDataFrom
(AstNode source) (package private) String
static AstNode
forPattern
(Pattern pattern) protected void
getAncestors
(Class<T> type) final <T extends AstNode>
TgetChildByRole
(Role<? extends T> role) final <T extends AstNode>
AstNodeCollection<T> getChildrenByRole
(Role<? extends T> role) final AstNode
final AstNode
final AstNode
final AstNode
final <T extends AstNode>
TgetNextSibling
(Role<? extends T> role) abstract NodeType
final AstNode
final <T extends AstNode>
Tfinal AstNode
final AstNode
final <T extends AstNode>
TgetPreviousSibling
(Role<? extends T> role) getRole()
getText()
getText
(JavaFormattingOptions options) final <T> T
getUserData
(Key<T> key) final boolean
final <T extends AstNode>
voidinsertChildAfter
(AstNode previousSibling, T child, Role<? extends T> role) final <T extends AstNode>
voidinsertChildBefore
(AstNode nextSibling, T child, Role<? extends T> role) (package private) final void
insertChildBeforeUnsafe
(AstNode nextSibling, AstNode child, Role<?> role) final <T extends AstNode>
voidinsertChildrenAfter
(AstNode nextSibling, Role<? extends T> role, T... children) final <T extends AstNode>
voidinsertChildrenBefore
(AstNode nextSibling, Role<? extends T> role, T... children) final boolean
isAncestorOf
(AstNode node) final boolean
isAncestorOf
(AstNode node, AstNode stopAt) final boolean
isDescendantOf
(AstNode node) final boolean
isInside
(int line, int column) final boolean
isInside
(TextLocation location) static boolean
boolean
isNull()
boolean
static boolean
isUnconditionalBranch
(AstNode statement) final Match
final boolean
abstract boolean
boolean
matchesCollection
(Role<?> role, INode position, Match match, BacktrackingInfo backtrackingInfo) protected static boolean
matchString
(String pattern, String text) final <T> void
putUserData
(Key<T> key, T value) final <T> T
putUserDataIfAbsent
(Key<T> key, T value) final void
remove()
final <T> boolean
final void
replaceWith
(AstNode newNode) final <T extends AstNode>
TreplaceWith
(Function<? super AstNode, ? extends T> replaceFunction) protected final <T extends AstNode>
voidsetChildByRole
(Role<? extends T> role, T newChild) final void
(package private) final void
setRoleUnsafe
(Role<?> role) toString()
Methods inherited from class com.strobel.core.Freezable
canFreeze, freeze, freezeIfUnfrozen, isFrozen, tryFreeze, verifyFrozen, verifyNotFrozen
-
Field Details
-
ROOT_ROLE
-
ROLE_INDEX_MASK
static final int ROLE_INDEX_MASK- See Also:
-
FROZEN_BIT
static final int FROZEN_BIT- See Also:
-
AST_NODE_USED_FLAGS
protected static final int AST_NODE_USED_FLAGS- See Also:
-
flags
protected int flags -
_parent
-
_previousSibling
-
_nextSibling
-
_firstChild
-
_lastChild
-
NULL
-
_dataStore
-
-
Constructor Details
-
AstNode
protected AstNode()
-
-
Method Details
-
matchString
-
isLoop
-
isUnconditionalBranch
-
setRoleUnsafe
-
acceptVisitor
-
clone
-
copyUserDataFrom
-
copyKey
-
getParent
-
getPreviousSibling
-
getLastChild
-
getFirstChild
- Specified by:
getFirstChild
in interfaceINode
-
getNextSibling
- Specified by:
getNextSibling
in interfaceINode
-
getPreviousSibling
-
getNextSibling
-
hasChildren
public final boolean hasChildren() -
getNextNode
-
getPreviousNode
-
getChildren
-
isAncestorOf
-
isAncestorOf
-
isDescendantOf
-
getAncestors
-
getAncestors
-
getAncestorsAndSelf
-
getDescendants
-
getDescendantsAndSelf
-
getChildByRole
-
getChildrenByRole
@NotNull public final <T extends AstNode> AstNodeCollection<T> getChildrenByRole(Role<? extends T> role) -
setChildByRole
-
getParent
-
addChild
-
addChildUnsafe
-
insertChildrenBefore
@SafeVarargs public final <T extends AstNode> void insertChildrenBefore(AstNode nextSibling, Role<? extends T> role, T... children) -
insertChildBefore
-
insertChildrenAfter
@SafeVarargs public final <T extends AstNode> void insertChildrenAfter(AstNode nextSibling, Role<? extends T> role, T... children) -
insertChildAfter
-
insertChildBeforeUnsafe
-
remove
public final void remove() -
replaceWith
-
replaceWith
-
freezeCore
protected void freezeCore()- Overrides:
freezeCore
in classFreezable
-
getNodeType
-
isReference
public boolean isReference() -
isNull
public boolean isNull() -
getRole
-
setRole
-
matches
-
matchesCollection
public boolean matchesCollection(Role<?> role, INode position, Match match, BacktrackingInfo backtrackingInfo) - Specified by:
matchesCollection
in interfaceINode
-
match
-
matches
-
forPattern
-
withName
-
makeOptional
-
getStartLocation
-
getEndLocation
-
getRegion
-
contains
public final boolean contains(int line, int column) -
contains
-
isInside
public final boolean isInside(int line, int column) -
isInside
-
getText
-
getText
-
debugToString
String debugToString() -
toString
-
getUserData
- Specified by:
getUserData
in interfaceUserDataStore
-
putUserData
- Specified by:
putUserData
in interfaceUserDataStore
-
putUserDataIfAbsent
- Specified by:
putUserDataIfAbsent
in interfaceUserDataStore
-
replace
- Specified by:
replace
in interfaceUserDataStore
-