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 Summary
Modifier and TypeMethodDescriptiondefault boolean
containsWithin(Node other)
Deprecated.default boolean
containsWithinRange(Node other)
Checks whether the range of the givenNode
is contained within the range of thisNodeWithRange
.getBegin()
The begin position of this node in the source file.getEnd()
The end position of this node in the source file.getRange()
default boolean
hasRange()
-
Method Details
-
getRange
-
setRange
-
getBegin
The begin position of this node in the source file. -
getEnd
The end position of this node in the source file. -
containsWithin
Deprecated.usecontainsWithinRange(Node)
instead. -
containsWithinRange
Checks whether the range of the givenNode
is 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 returntrue
for 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:
true
if the given node's range is contained within this node's range, andfalse
otherwise.
-
hasRange
default boolean hasRange()
-
containsWithinRange(Node)
instead.