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,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,LongLiteralExpr,MarkerAnnotationExpr,MemberValuePair,MethodCallExpr,MethodDeclaration,MethodReferenceExpr,Modifier,ModuleDeclaration,ModuleDirective,ModuleExportsDirective,ModuleOpensDirective,ModuleProvidesDirective,ModuleRequiresDirective,ModuleUsesDirective,Name,NameExpr,Node,NormalAnnotationExpr,NullLiteralExpr,ObjectCreationExpr,PackageDeclaration,Parameter,PrimitiveType,ReceiverParameter,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 Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description default booleancontainsWithin(Node other)Deprecated.usecontainsWithinRange(Node)instead.default booleancontainsWithinRange(Node other)Checks whether the range of the givenNodeis contained within the range of thisNodeWithRange.default Optional<Position>getBegin()The begin position of this node in the source file.default Optional<Position>getEnd()The end position of this node in the source file.Optional<Range>getRange()NsetRange(Range range)
-
-
-
Method Detail
-
containsWithin
@Deprecated default boolean containsWithin(Node other)
Deprecated.usecontainsWithinRange(Node)instead.
-
containsWithinRange
default boolean containsWithinRange(Node other)
Checks whether the range of the givenNodeis contained within the range of thisNodeWithRange. Note that any range contains itself, i.e., for any noden, we have thatn.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 returntruefor a node that is contained in a different file than thisNodeWithRange. You may wish to useNode.isAncestorOf(Node)instead.- Parameters:
other- the node whose range should be compared with this node's range.- Returns:
trueif the given node's range is contained within this node's range, andfalseotherwise.
-
-