|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.metamatrix.common.util.Intervals
public class Intervals
This class can be used to represent a collection of intervals. As new intervals are added, they are merged into existing intervals to maintain the most compact description of the intervals that is possible. Interval endpoints are inclusive - a single index can be identified by an interval like [1,1].For instance, if you added the intervals 1-3, 5-9, 4-4, they would be stored as 1-9.
| Constructor Summary | |
|---|---|
Intervals()
Constructor for Intervals. |
|
Intervals(int begin,
int end)
|
|
| Method Summary | |
|---|---|
void |
addInterval(int begin,
int end)
Add an interval from begin to end, inclusive. |
Intervals |
addIntervals(Intervals additionalIntervals)
|
boolean |
containsInterval(int begin,
int end)
Returns true if the specified interval is contained in the current intervals. |
Intervals |
copy()
|
boolean |
equals(java.lang.Object obj)
Compares two intervals for equality |
int[] |
getBoundingInterval()
|
Intervals |
getIntersection(int begin,
int end)
Determine the portion of the current intervals that overlaps with the specified interval. |
Intervals |
getIntersectionIntervals(Intervals intersectionIntervals)
|
java.util.List |
getIntervals()
Return ordered list of intervals representing current intervals. |
int |
hashCode()
Returns hash code for the set of intervals. |
boolean |
hasIntervals()
True if this set of intervals contains any intervals. |
boolean |
isContiguous()
Determine there is one interval with no gaps. |
void |
removeInterval(int begin,
int end)
Remove an interval from begin to end, inclusive. |
Intervals |
removeIntervals(Intervals intervalsToRemove)
|
java.lang.String |
toString()
Returns string representation of intervals. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Intervals()
public Intervals(int begin,
int end)
| Method Detail |
|---|
public boolean hasIntervals()
public void addInterval(int begin,
int end)
begin - Begin indexend - End index
java.lang.IllegalArgumentException - If begin > end
public void removeInterval(int begin,
int end)
begin - Begin indexend - End index
java.lang.IllegalArgumentException - If begin > endpublic Intervals removeIntervals(Intervals intervalsToRemove)
public boolean containsInterval(int begin,
int end)
begin - Begin indexend - End index
java.lang.IllegalArgumentException - If begin > end
public Intervals getIntersection(int begin,
int end)
begin - end -
java.lang.IllegalArgumentException - If begin > endpublic Intervals getIntersectionIntervals(Intervals intersectionIntervals)
public Intervals addIntervals(Intervals additionalIntervals)
public java.util.List getIntervals()
public boolean isContiguous()
public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - Other object
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int[] getBoundingInterval()
public Intervals copy()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||