public final class Range extends Object
Modifier and Type | Field and Description |
---|---|
static Comparator<Range> |
DEPENDENCY_ORDER_COMPARATOR
Sorts Ranges so that a Range will be preceded by any Ranges that enclose
it.
|
static Comparator<Range> |
SOURCE_ORDER_COMPARATOR
Sorts Ranges into the order in which they would appear in the source code
based on start position and end position.
|
Constructor and Description |
---|
Range(int start,
int end)
Constructor.
|
Range(int start,
int end,
int startLine,
int startColumn,
int endLine,
int endColumn,
SourceInfo sourceInfo)
A range whose start and end are specified both as character positions and as
line numbers and columns.
|
Range(int start,
int end,
SourceInfo sourceInfo)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Range o)
Return
true if the given Range lies wholly within the Range. |
Range |
createNormalizedCopy(int baseStart,
int baseStartLine)
Creates a Range copy whose start position and line number have been rebased relative to some
base position.
|
Range |
createOffsetCopy(int positionOffset,
int lineOffset)
Creates a Range copy whose start position and line number have been moved by some known offset
size.
|
boolean |
equals(Object obj) |
int |
getEnd() |
int |
getEndColumn() |
int |
getEndLine() |
SourceInfo |
getSourceInfo() |
int |
getStart() |
int |
getStartColumn() |
int |
getStartLine() |
int |
hashCode() |
int |
length() |
String |
toString()
For debugging use only.
|
Range |
withNewEnd(int newEnd,
int newEndLine,
int newEndColumn)
Returns a copy with the end moved.
|
public static final Comparator<Range> DEPENDENCY_ORDER_COMPARATOR
public static final Comparator<Range> SOURCE_ORDER_COMPARATOR
public Range(int start, int end)
start
- must be non-negativeend
- must be greater than or equal to start
public Range(int start, int end, SourceInfo sourceInfo)
start
- must be non-negativeend
- must be greater than or equal to start
public Range(int start, int end, int startLine, int startColumn, int endLine, int endColumn, SourceInfo sourceInfo)
start
- must be non-negativeend
- must be greater than or equal to start
public boolean contains(Range o)
true
if the given Range lies wholly within the Range.public Range createNormalizedCopy(int baseStart, int baseStartLine)
For example a range that starts at byte 5342 when normalized against a base start of 5000 will now start at byte 342.
public Range createOffsetCopy(int positionOffset, int lineOffset)
For example a range that starts at byte 342 when moved by an offset of 5000 will now start at byte 5342.
public int getEnd()
public int getEndColumn()
public int getEndLine()
public SourceInfo getSourceInfo()
public int getStart()
public int getStartColumn()
public int getStartLine()
public int length()
public Range withNewEnd(int newEnd, int newEndLine, int newEndColumn)
Copyright © 2018. All rights reserved.