public class Interval
extends java.lang.Object
implements java.io.Serializable
| Modifier and Type | Field and Description |
|---|---|
int |
end |
static <any> |
SERIALIZER |
int |
start |
| Modifier | Constructor and Description |
|---|---|
protected |
Interval(int start,
int end)
create an interval
Invariant start <= end is checked.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
covers(Interval other)
Check if this interval covers completely other.
|
static Interval |
getEnvelope(Interval a,
Interval b)
Get smallest interval that contains a and b.
|
static boolean |
isAdjacentOrOverlap(Interval a,
Interval b)
Check if there is no gap between a and b
|
boolean |
less(Interval other)
Check this interval is lower than other (and no overlap)
|
static Interval |
of(int start,
int end)
create an interval
Invariant start <= end is checked.
|
boolean |
overlaps(int start2,
int end2) |
static Interval |
parse(java.lang.String text)
Simple parser of an interval
format: [ x, y ]
example [2008,2015]
|
java.lang.String |
toString() |
public final int start
public final int end
public static final <any> SERIALIZER
protected Interval(int start,
int end)
start - end - public static Interval of(int start, int end)
start - end - public static boolean isAdjacentOrOverlap(Interval a, Interval b)
a - b - public boolean overlaps(int start2,
int end2)
public static Interval getEnvelope(Interval a, Interval b)
a - b - public boolean less(Interval other)
other - public boolean covers(Interval other)
other - public static Interval parse(java.lang.String text)
public java.lang.String toString()
toString in class java.lang.Object