public class Interval extends Object implements Intervalable
| Constructor and Description |
|---|
Interval(int start,
int end)
Constructs an interval with a start and end position.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Object o) |
boolean |
equals(Object o) |
int |
getEnd()
Returns the ending offset into the text for this interval.
|
int |
getStart()
Returns the starting offset into the text for this interval.
|
int |
hashCode() |
boolean |
overlapsWith(int point) |
boolean |
overlapsWith(Interval other)
Answers whether the given interval overlaps this interval
instance.
|
int |
size()
Returns the length of the interval.
|
String |
toString()
Returns the starting offset and ending offset separated
by a full colon (:).
|
public Interval(int start,
int end)
start - The interval's starting text position.end - The interval's ending text position.public int getStart()
getStart in interface Intervalablepublic int getEnd()
getEnd in interface Intervalablepublic int size()
size in interface Intervalablepublic boolean overlapsWith(Interval other)
other - public boolean overlapsWith(int point)
public int compareTo(Object o)
compareTo in interface ComparableCopyright © 2014–2017 42 BV. All rights reserved.