-
- All Superinterfaces:
Comparable<Interval>
public interface Interval extends Comparable<Interval>
This class is adapted from : a balanced binary-search tree keyed by Interval objects.- Author:
- Mason M Lai, Charles Prud'homme
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default int
compareTo(int s, int e)
default int
compareTo(Interval o)
int
end()
Returns the ending point of this.default boolean
isAdjacent(Interval other)
Returns if this interval is adjacent to the specified interval.default int
length()
Returns the length of this.default boolean
overlaps(int start, int end)
default boolean
overlaps(Interval o)
int
start()
Returns the starting point of this.
-
-
-
Method Detail
-
start
int start()
Returns the starting point of this.
-
end
int end()
Returns the ending point of this.The interval does not include this point.
-
length
default int length()
Returns the length of this.
-
isAdjacent
default boolean isAdjacent(Interval other)
Returns if this interval is adjacent to the specified interval.Two intervals are adjacent if either one ends where the other starts.
- Parameters:
other
- - the interval to compare this one to- Returns:
- if this interval is adjacent to the specified interval.
-
overlaps
default boolean overlaps(Interval o)
-
overlaps
default boolean overlaps(int start, int end)
-
compareTo
default int compareTo(Interval o)
- Specified by:
compareTo
in interfaceComparable<Interval>
-
compareTo
default int compareTo(int s, int e)
-
-