public class Interval<T extends Comparable<T>> extends Object implements Comparable<Interval<T>>
| Constructor and Description |
|---|
Interval(T low,
boolean isClosedOnLow,
T high,
boolean isClosedOnHigh)
Construct a new instance with the specified low and high endpoints.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Interval<T> o) |
boolean |
contains(Interval<T> interval)
Test whether or not this interval contains the specified interval.
|
boolean |
contains(T value)
Test whether or not this interval contains the specified value.
|
boolean |
equals(Object obj) |
T |
getHigh()
Get the high endpoint.
|
T |
getLow()
Get the low endpoint.
|
int |
hashCode() |
boolean |
isClosedOnHigh() |
boolean |
isClosedOnLow() |
boolean |
overlaps(Interval<T> interval)
Test whether or not this interval and the specified interval overlap.
|
String |
toString() |
public Interval(T low, boolean isClosedOnLow, T high, boolean isClosedOnHigh)
low - the low endpoint.isClosedOnLow - true if this interval contains its low endpoint, false
otherwise.high - the high endpoint.isClosedOnHigh - true if this interval contains its high endpoint, false
otherwise.public int compareTo(Interval<T> o)
compareTo in interface Comparable<Interval<T extends Comparable<T>>>public boolean contains(Interval<T> interval)
interval - the query interval, non-null.public boolean contains(T value)
value - the query value, non-null.public T getHigh()
public T getLow()
public boolean isClosedOnHigh()
public boolean isClosedOnLow()
public boolean overlaps(Interval<T> interval)
interval - the query interval.Copyright © 1994–2024 Peter Murray-Rust. All rights reserved.