Top Description Methods
com.github.javaparser.ast.nodeTypes

public Interface NodeWithRange<N>

Known Direct Implementers
com.github.javaparser.ast.Node
Imports
com.github.javaparser.Position, .Range, com.github.javaparser.ast.Node, java.util.Optional

A node that has a Range, which is every Node.

Method Summary

Modifier and TypeMethod and Description
public default boolean
containsWithin(Node other)

Deprecated use containsWithinRange(Node) instead.
public default boolean

Returns:

true if the given node's range is contained within this node's range, and false otherwise.
containsWithinRange
(Node
the node whose range should be compared with this node's range.
other
)

Checks whether the range of the given Node is contained within the range of this NodeWithRange.

public default Optional<Position>
getBegin()

The begin position of this node in the source file.

public default Optional<Position>
getEnd()

The end position of this node in the source file.

public Optional<Range>
public N
setRange(Range range)

Method Detail

containsWithinback to summary
public default boolean containsWithin(Node other)

Deprecated

use containsWithinRange(Node) instead.

Annotations
@Deprecated
containsWithinRangeback to summary
public 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:Node

the node whose range should be compared with this node's range.

Returns:boolean

true if the given node's range is contained within this node's range, and false otherwise.

getBeginback to summary
public default Optional<Position> getBegin()

The begin position of this node in the source file.

getEndback to summary
public default Optional<Position> getEnd()

The end position of this node in the source file.

getRangeback to summary
public Optional<Range> getRange()
setRangeback to summary
public N setRange(Range range)