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

public abstract class AstNode extends Freezable implements INode, UserDataStore, Cloneable
  • Field Details

  • Constructor Details

    • AstNode

      protected AstNode()
  • Method Details

    • matchString

      protected static boolean matchString(String pattern, String text)
    • isLoop

      public static boolean isLoop(AstNode statement)
    • isUnconditionalBranch

      public static boolean isUnconditionalBranch(AstNode statement)
    • setRoleUnsafe

      final void setRoleUnsafe(Role<?> role)
    • acceptVisitor

      public abstract <T, R> R acceptVisitor(IAstVisitor<? super T,? extends R> visitor, T data)
    • clone

      public AstNode clone()
      Overrides:
      clone in class Object
    • copyUserDataFrom

      public void copyUserDataFrom(AstNode source)
    • copyKey

      private static <T> void copyKey(AstNode source, AstNode target, Key<T> key)
    • getParent

      public final AstNode getParent()
    • getPreviousSibling

      public final AstNode getPreviousSibling()
    • getLastChild

      public final AstNode getLastChild()
    • getFirstChild

      public final AstNode getFirstChild()
      Specified by:
      getFirstChild in interface INode
    • getNextSibling

      public final AstNode getNextSibling()
      Specified by:
      getNextSibling in interface INode
    • getPreviousSibling

      public final <T extends AstNode> T getPreviousSibling(Role<? extends T> role)
    • getNextSibling

      public final <T extends AstNode> T getNextSibling(Role<? extends T> role)
    • hasChildren

      public final boolean hasChildren()
    • getNextNode

      public final AstNode getNextNode()
    • getPreviousNode

      public final AstNode getPreviousNode()
    • getChildren

      public final Iterable<AstNode> getChildren()
    • isAncestorOf

      public final boolean isAncestorOf(AstNode node)
    • isAncestorOf

      public final boolean isAncestorOf(AstNode node, AstNode stopAt)
    • isDescendantOf

      public final boolean isDescendantOf(AstNode node)
    • getAncestors

      public final <T extends AstNode> Iterable<T> getAncestors(@NotNull Class<T> type)
    • getAncestors

      public final Iterable<AstNode> getAncestors()
    • getAncestorsAndSelf

      public final Iterable<AstNode> getAncestorsAndSelf()
    • getDescendants

      public final Iterable<AstNode> getDescendants()
    • getDescendantsAndSelf

      public final Iterable<AstNode> getDescendantsAndSelf()
    • getChildByRole

      @NotNull public final <T extends AstNode> T getChildByRole(Role<? extends T> role)
    • getChildrenByRole

      @NotNull public final <T extends AstNode> AstNodeCollection<T> getChildrenByRole(Role<? extends T> role)
    • setChildByRole

      protected final <T extends AstNode> void setChildByRole(Role<? extends T> role, T newChild)
    • getParent

      public final <T extends AstNode> T getParent(Class<T> nodeType)
    • addChild

      public final <T extends AstNode> void addChild(T child, Role<? extends T> role)
    • addChildUnsafe

      final void addChildUnsafe(AstNode child, Role<?> role)
    • insertChildrenBefore

      @SafeVarargs public final <T extends AstNode> void insertChildrenBefore(AstNode nextSibling, Role<? extends T> role, T... children)
    • insertChildBefore

      public final <T extends AstNode> void insertChildBefore(AstNode nextSibling, T child, Role<? extends T> role)
    • insertChildrenAfter

      @SafeVarargs public final <T extends AstNode> void insertChildrenAfter(AstNode nextSibling, Role<? extends T> role, T... children)
    • insertChildAfter

      public final <T extends AstNode> void insertChildAfter(AstNode previousSibling, T child, Role<? extends T> role)
    • insertChildBeforeUnsafe

      final void insertChildBeforeUnsafe(AstNode nextSibling, AstNode child, Role<?> role)
    • remove

      public final void remove()
    • replaceWith

      public final void replaceWith(AstNode newNode)
    • replaceWith

      public final <T extends AstNode> T replaceWith(Function<? super AstNode,? extends T> replaceFunction)
    • freezeCore

      protected void freezeCore()
      Overrides:
      freezeCore in class Freezable
    • getNodeType

      public abstract NodeType getNodeType()
    • isReference

      public boolean isReference()
    • isNull

      public boolean isNull()
      Specified by:
      isNull in interface INode
    • getRole

      public Role<? extends AstNode> getRole()
      Specified by:
      getRole in interface INode
    • setRole

      public final void setRole(Role<?> role)
    • matches

      public abstract boolean matches(INode other, Match match)
      Specified by:
      matches in interface INode
    • matchesCollection

      public boolean matchesCollection(Role<?> role, INode position, Match match, BacktrackingInfo backtrackingInfo)
      Specified by:
      matchesCollection in interface INode
    • match

      public final Match match(INode other)
      Specified by:
      match in interface INode
    • matches

      public final boolean matches(INode other)
      Specified by:
      matches in interface INode
    • forPattern

      public static AstNode forPattern(Pattern pattern)
    • withName

      public NamedNode withName(String name)
    • makeOptional

      public OptionalNode makeOptional()
    • getStartLocation

      public TextLocation getStartLocation()
    • getEndLocation

      public TextLocation getEndLocation()
    • getRegion

      public Region getRegion()
    • contains

      public final boolean contains(int line, int column)
    • contains

      public final boolean contains(TextLocation location)
    • isInside

      public final boolean isInside(int line, int column)
    • isInside

      public final boolean isInside(TextLocation location)
    • getText

      public String getText()
    • getText

      public String getText(JavaFormattingOptions options)
    • debugToString

      String debugToString()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getUserData

      public final <T> T getUserData(Key<T> key)
      Specified by:
      getUserData in interface UserDataStore
    • putUserData

      public final <T> void putUserData(Key<T> key, T value)
      Specified by:
      putUserData in interface UserDataStore
    • putUserDataIfAbsent

      public final <T> T putUserDataIfAbsent(Key<T> key, T value)
      Specified by:
      putUserDataIfAbsent in interface UserDataStore
    • replace

      public final <T> boolean replace(Key<T> key, T oldValue, T newValue)
      Specified by:
      replace in interface UserDataStore