Interface NodeWithRange<N>

All Known Implementing Classes:
AnnotationDeclaration, AnnotationExpr, AnnotationMemberDeclaration, ArrayAccessExpr, ArrayCreationExpr, ArrayCreationLevel, ArrayInitializerExpr, ArrayType, AssertStmt, AssignExpr, BinaryExpr, BlockComment, BlockStmt, BodyDeclaration, BooleanLiteralExpr, BreakStmt, CallableDeclaration, CastExpr, CatchClause, CharLiteralExpr, ClassExpr, ClassOrInterfaceDeclaration, ClassOrInterfaceType, Comment, CompactConstructorDeclaration, CompilationUnit, ConditionalExpr, ConstructorDeclaration, ContinueStmt, DoStmt, DoubleLiteralExpr, EmptyStmt, EnclosedExpr, EnumConstantDeclaration, EnumDeclaration, ExplicitConstructorInvocationStmt, Expression, ExpressionStmt, FieldAccessExpr, FieldDeclaration, ForEachStmt, ForStmt, IfStmt, ImportDeclaration, InitializerDeclaration, InstanceOfExpr, IntegerLiteralExpr, IntersectionType, JavadocComment, LabeledStmt, LambdaExpr, LineComment, LiteralExpr, LiteralStringValueExpr, LocalClassDeclarationStmt, LocalRecordDeclarationStmt, LongLiteralExpr, MarkerAnnotationExpr, MemberValuePair, MethodCallExpr, MethodDeclaration, MethodReferenceExpr, Modifier, ModuleDeclaration, ModuleDirective, ModuleExportsDirective, ModuleOpensDirective, ModuleProvidesDirective, ModuleRequiresDirective, ModuleUsesDirective, Name, NameExpr, Node, NormalAnnotationExpr, NullLiteralExpr, ObjectCreationExpr, PackageDeclaration, Parameter, PatternExpr, PrimitiveType, ReceiverParameter, RecordDeclaration, ReferenceType, ReturnStmt, SimpleName, SingleMemberAnnotationExpr, Statement, StringLiteralExpr, SuperExpr, SwitchEntry, SwitchExpr, SwitchStmt, SynchronizedStmt, TextBlockLiteralExpr, ThisExpr, ThrowStmt, TryStmt, Type, TypeDeclaration, TypeExpr, TypeParameter, UnaryExpr, UnionType, UnknownType, UnparsableStmt, VariableDeclarationExpr, VariableDeclarator, VarType, VoidType, WhileStmt, WildcardType, YieldStmt

public interface NodeWithRange<N>
A node that has a Range, which is every Node.
  • Method Details

    • getRange

      Optional<Range> getRange()
    • setRange

      N setRange(Range range)
    • getBegin

      default Optional<Position> getBegin()
      The begin position of this node in the source file.
    • getEnd

      default Optional<Position> getEnd()
      The end position of this node in the source file.
    • containsWithin

      @Deprecated default boolean containsWithin(Node other)
      Deprecated.
    • containsWithinRange

      default boolean containsWithinRange(Node other)
      Checks whether the range of the given Node is contained within the range of this NodeWithRange. Note that any range contains itself, i.e., for any node n, we have that n.containsWithinRange(n) == true. Notice: This method compares two nodes based on their ranges only, but not based on the storage unit of the two nodes. Therefore, this method may return true for a node that is contained in a different file than this NodeWithRange. You may wish to use Node.isAncestorOf(Node) instead.
      Parameters:
      other - the node whose range should be compared with this node's range.
      Returns:
      true if the given node's range is contained within this node's range, and false otherwise.
    • hasRange

      default boolean hasRange()