Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## calhoun.util
Class RangeMap

    java.lang.Object
      calhoun.util.RangeMap

All Implemented Interfaces:
  java.io.Serializable

    public class RangeMap

extends java.lang.Object
implements java.io.Serializable

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.

See Also:
  Serialized Form

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

### serialVersionUID

    public static final long serialVersionUID

See Also:
  Constant Field Values

Constructor Detail

### RangeMap

    public RangeMap()

Method Detail

### size

    public int size()

### values

    public java.util.Set values()

### getStart

    public int getStart()

  Returns the start of the first non-empty interval. If the RangeMap has no entries, returns 0.

### getStop

    public int getStop()

  Returns the end of the last interval

### getMap

    public java.util.SortedMap getMap()

### getObjectList

    public java.util.Map getObjectList()

### getDisjointRegions

    public java.util.List getDisjointRegions()

### getRegions

    public java.util.List getRegions()

### getRegions

    public java.util.List getRegions(boolean splitDisjointRegions)

  Returns a list of Interval objects that contain overlapping elements.

  Parameters:
    `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.
  See Also:
    `getIntervals()`

### getIntervals

    public java.util.List getIntervals()

  Returns the individual intervals in the rangeMap. An interval is an area of a range map where every point in that area is overlapped by the same set of elements. Consider this: <-----Feature A-----> <---Feature C---> <---------Feature B---------> | 1 | 2 | 3 | 4 | 5 | This would be represented by one region but counts as five intervals: interval 1 contains A only, interval 2 contains A & B, interval 3 holds B only, and so on. Callers should be prepared for Intervals that contain no elements. This method returns a List of Interval objects. The Interval objects returned will be in increasing order of their placement on the RangeMap.

  See Also:
    `getRegions()`

### getIntervals

    public java.util.List getIntervals(int start,
                                       int stop)

  Like getIntervals, but allows you to define a start and stop. First and last interval are guaranteed to start and stop at the endpoints.

### getEmptyIntervals

    public java.util.List getEmptyIntervals(int start,
                                            int totalSize)

  Returns the empty intervals. A start and stop are required to bound the edges of the first and last region. These bounds can be within the existin region. The returned intervals are closed.

### find

    public java.util.Set find(int argLow,
                              int argHigh)

  Returns objects in the range map that overlap this range. query: *-----------------* returned *------------* returned *-------------* returned *---------------------* returned *----* returned *-* returned

### findContained

    public java.util.Set findContained(int argLow,
                                       int argHigh)

  Returns objects in the range map that are fully contained by the range. query: *-----------------* returned *------------* not returned *-------------* returned *---------------------* not returned *----* not returned *-* not returned

### findContaining

    public java.util.Set findContaining(int argLow,
                                        int argHigh)

  Returns objects in the range map that fully contain the range. query: *-----------------* returned *------------* not returned *-------------* not returned *---------------------* returned *----* not returned *-* not returned

### hasEntry

    public boolean hasEntry(int argLow,
                            int argHigh)

  Returns true if the map has an entry in the specfied range.

### add

    public void add(int argLow,
                    int argHigh,
                    java.lang.Object o)

  Adds the object o into the map with interval lo - high. The interval is inclusive, with both the high and low being part of the interval.

### contains

    public boolean contains(java.lang.Object o)

  Returns true if the object is in the RangeMap

### remove

    public void remove(java.lang.Object o)

  Removes the object o from the map.

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD