|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcalhoun.util.RangeMap
public class RangeMap
A rangeMap contains a set of intervals and maps each interval to a set of objects that exist in that interval. It allows very fast lookups of range queries. An interval is closed, that is, the interval from 20-30 includes both 20 and 30.
| Nested Class Summary | |
|---|---|
static class |
RangeMap.Interval
An interval is a convenient data structure used to return a section of a RangeMap. |
| Field Summary | |
|---|---|
static long |
serialVersionUID
|
| Constructor Summary | |
|---|---|
RangeMap()
|
|
| Method Summary | |
|---|---|
void |
add(int argLow,
int argHigh,
java.lang.Object o)
Adds the object o into the map with interval lo - high. |
boolean |
contains(java.lang.Object o)
Returns true if the object is in the RangeMap |
java.util.Set |
find(int argLow,
int argHigh)
Returns objects in the range map that overlap this range. |
java.util.Set |
findContained(int argLow,
int argHigh)
Returns objects in the range map that are fully contained by the range. |
java.util.Set |
findContaining(int argLow,
int argHigh)
Returns objects in the range map that fully contain the range. |
java.util.List |
getDisjointRegions()
|
java.util.List |
getEmptyIntervals(int start,
int totalSize)
Returns the empty intervals. |
java.util.List |
getIntervals()
Returns the individual intervals in the rangeMap. |
java.util.List |
getIntervals(int start,
int stop)
Like getIntervals, but allows you to define a start and stop. |
java.util.SortedMap |
getMap()
|
java.util.Map |
getObjectList()
|
java.util.List |
getRegions()
|
java.util.List |
getRegions(boolean splitDisjointRegions)
Returns a list of Interval objects that contain overlapping elements. |
int |
getStart()
Returns the start of the first non-empty interval. |
int |
getStop()
Returns the end of the last interval |
boolean |
hasEntry(int argLow,
int argHigh)
Returns true if the map has an entry in the specfied range. |
void |
remove(java.lang.Object o)
Removes the object o from the map. |
int |
size()
|
java.lang.String |
toString()
|
java.util.Set |
values()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final long serialVersionUID
| Constructor Detail |
|---|
public RangeMap()
| Method Detail |
|---|
public int size()
public java.util.Set values()
public int getStart()
public int getStop()
public java.util.SortedMap getMap()
public java.util.Map getObjectList()
public java.util.List getDisjointRegions()
public java.util.List getRegions()
public java.util.List getRegions(boolean splitDisjointRegions)
splitDisjointRegions - if true, return disjoint regions,
if false, return "old-style" regions. Consider the following:
<---------Feature A------->
<----------Feature B---------->
<---------Feature C------->
- If we group these into a single region, then any two groups
returned by this method will be separated by at least one gap
(ie an area that contains no elements at all). This is more
convenient.
- If we group them into two regions, then every element in
a region will overlap at least one other element in that
region (if the region contains more than one element).
This is more mathematically precise.
There are good reasons to want either behavior so we support both.
Disjoint regions are more mathematically consistent but may lie
immediately adjacent to each other. Nondisjoint regions are better
separated, but "old-style" regions may contain an element that
does not overlap anything else within it.
No element in a region will ever overlap an element outside the region.
This method returns a List of Interval objects. The Interval objects
returned will be in increasing order of their placement on the RangeMap.getIntervals()public java.util.List getIntervals()
getRegions()
public java.util.List getIntervals(int start,
int stop)
public java.util.List getEmptyIntervals(int start,
int totalSize)
public java.util.Set find(int argLow,
int argHigh)
public java.util.Set findContained(int argLow,
int argHigh)
public java.util.Set findContaining(int argLow,
int argHigh)
public boolean hasEntry(int argLow,
int argHigh)
public void add(int argLow,
int argHigh,
java.lang.Object o)
public boolean contains(java.lang.Object o)
public void remove(java.lang.Object o)
public java.lang.String toString()
toString in class java.lang.Object
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||