public final class IndexRange extends Object
Modifier and Type | Field and Description |
---|---|
int |
end
The index of the character following the last character of the range.
|
int |
start
The index of the first character in the range.
|
Constructor and Description |
---|
IndexRange(int start,
int end) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
int |
hashCode() |
boolean |
isEmpty()
Determines whether this range contains no characters.
|
boolean |
isFollowedBy(IndexRange other)
Determines whether this range is immediated followed by the given other one.
|
boolean |
isPrecededBy(IndexRange other)
Determines whether this range immediated follows the given other one.
|
int |
length() |
IndexRange |
mergedWith(IndexRange other)
Created a new IndexRange that spans all characters between the smallest and the highest index of the two ranges.
|
boolean |
overlapsWith(IndexRange other)
Determines whether this range overlaps with the given other one.
|
String |
toString() |
boolean |
touches(IndexRange other)
Determines whether this range immediated follows or precedes the given other one.
|
public final int start
public final int end
public boolean isEmpty()
public int length()
public boolean overlapsWith(IndexRange other)
other
- the other rangepublic boolean isPrecededBy(IndexRange other)
other
- the other rangepublic boolean isFollowedBy(IndexRange other)
other
- the other rangepublic boolean touches(IndexRange other)
other
- the other rangepublic IndexRange mergedWith(IndexRange other)
other
- the other range