public class Interval extends Object implements Comparable<Interval>
Modifier and Type | Field and Description |
---|---|
static Interval |
ALWAYS
The interval that is always possible.
|
static Interval |
NEVER
The interval that is never possible.
|
static long |
UNDEFINED_MS
The undefined ms value for start or end.
|
Modifier and Type | Method and Description |
---|---|
Interval |
add(long value)
Add an offset to the interval.
|
static Interval |
after(long startMs) |
static Interval |
before(long endMs) |
static Interval |
between(long startMs,
long endMs) |
int |
compareTo(Interval o) |
boolean |
equals(Object o) |
long |
getEndMs() |
long |
getStartMs() |
int |
hashCode() |
Interval |
intersect(Interval other) |
boolean |
isValid() |
IntervalSet |
negate() |
String |
toString() |
public static final long UNDEFINED_MS
public static final Interval NEVER
public static final Interval ALWAYS
public static Interval between(long startMs, long endMs)
startMs
- the start of the interval, in msendMs
- the end of the interval, in mspublic static Interval before(long endMs)
endMs
- the end of the interval, in mspublic static Interval after(long startMs)
startMs
- the start of the interval, in mspublic long getStartMs()
public long getEndMs()
public boolean isValid()
public Interval intersect(Interval other)
other
- the other Intervalpublic IntervalSet negate()
public Interval add(long value)
value
- the value to addArithmeticException
- if the result overflowspublic int compareTo(Interval o)
compareTo
in interface Comparable<Interval>
Copyright © 2023. All Rights Reserved.