orc.lib.state
Class Interval<T extends java.lang.Comparable>
java.lang.Object
orc.lib.state.Interval<T>
- All Implemented Interfaces:
- java.lang.Comparable<Interval<T>>
public final class Interval<T extends java.lang.Comparable>
- extends java.lang.Object
- implements java.lang.Comparable<Interval<T>>
Constructor Summary |
Interval(T point)
Construct an empty interval. |
Interval(T start,
T end)
Construct a non-empty interval. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Interval
public Interval(T point)
- Construct an empty interval.
Interval
public Interval(T start,
T end)
- Construct a non-empty interval.
union
public Interval<T> union(Interval<T> that)
intersect
public Interval<T> intersect(Interval<T> that)
intersects
public boolean intersects(Interval<T> that)
contiguous
public boolean contiguous(Interval<T> that)
spans
public boolean spans(T point)
isEmpty
public boolean isEmpty()
getStart
public T getStart()
getEnd
public T getEnd()
compareTo
public int compareTo(Interval<T> that)
- Returns 0 if the intervals overlap. For non-disjoint intervals, this
violates transitivity, but that's ok because we ensure that only
disjoint ranges are stored in a sorted set.
Note that even if this method returns 0, the two objects are
not necessarily equal.
- Specified by:
compareTo
in interface java.lang.Comparable<Interval<T extends java.lang.Comparable>>
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object