|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.numericalmethod.suanshu.interval.Intervals<T>
T - a class that is Comparablepublic class Intervals<T extends java.lang.Comparable<T>>
This class represents a disjoint set of Intervals.
This implementation keeps the disjointed intervals sorted in ascending order. That is, suppose I1 is indexed before I2. It means that the end of I1 is strictly smaller than the begin of I2, as defined by the partial ordering relation.
| Constructor Summary | |
|---|---|
Intervals()
Construct an empty set of Intervals. |
|
Intervals(Interval<T>... intervals)
Construct a set of Intervals from the given intervals. |
|
Intervals(Interval<T> interval)
Construct a set that contains only one Interval. |
|
Intervals(Intervals<T> that)
Copy constructor. |
|
Intervals(T begin,
T end)
Construct a set that contains only one interval [begin, end]. |
|
| Method Summary | |
|---|---|
void |
add(Interval<T>... intervals)
Add a collection of Intervals to the set. |
void |
add(Interval<T> interval)
Add an Interval to the set. |
boolean |
equals(java.lang.Object obj)
|
Interval<T> |
get(int i)
Get the i-th interval. |
int |
hashCode()
|
int |
size()
Get the number of disjoint intervals. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Intervals()
Intervals.
public Intervals(Interval<T> interval)
Interval.
interval - an Interval
public Intervals(T begin,
T end)
[begin, end].
begin - the beginning of an Intervalend - the end of an Intervalpublic Intervals(Interval<T>... intervals)
Intervals from the given intervals.
intervals - Intervalspublic Intervals(Intervals<T> that)
that - another Intervals| Method Detail |
|---|
public int size()
public Interval<T> get(int i)
i-th interval.
The intervals are sorted such that if I1 is indexed before I2, then the end of I1 is strictly smaller than the begin of I2.
i - the index, counting from 0
i-th intervalpublic void add(Interval<T> interval)
Interval to the set.
The union remains disjoint and sorted.
interval - an Intervalpublic void add(Interval<T>... intervals)
Intervals to the set.
The set remains disjoint.
intervals - an array of Intervalspublic java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Object
|
SuanShu, a Java numerical and statistical library | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||