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

## com.bbn.openmap.geo
Class ExtentIndex.AbstractExtentIndex

    java.lang.Object
      java.util.AbstractCollection
          com.bbn.openmap.geo.ExtentIndex.AbstractExtentIndex

All Implemented Interfaces:
  java.util.Collection, ExtentIndex

Direct Known Subclasses:
  ExtentIndex.ArrayListExtentIndexImpl, ExtentIndex.HashSetExtentIndexImpl

Enclosing class:
  ExtentIndex

public abstract static class ExtentIndex.AbstractExtentIndex
extends java.util.AbstractCollection
implements ExtentIndex

A basic implementation of ExtentIndex that uses Collection-typed buckets. Extending classes must implement #makeBucket(int) to specify an alternative Collection implementation.

Nested Class Summary

Nested classes inherited from class com.bbn.openmap.geo.ExtentIndex
`ExtentIndex.AbstractExtentIndex, ExtentIndex.ArrayListExtentIndexImpl, ExtentIndex.HashSetExtentIndexImpl`

Field Summary
`protected java.util.Collection` | `all` all is a collection of everything successfully indexed.
`protected java.util.Collection[]` | `buckets`
`static double` | `D_MARGIN` Default value for #margin if not specified in the call to the constructor.
`static int` | `D_NBUCKETS` Default value for #nbuckets if not specified in the call to the constructor.
`protected java.util.Collection` | `discarded`
`double` | `margin` how much of a margin to put around regions for indexing purposes, in nautical miles.
`int` | `nbuckets` how many buckets in the longitudinal index - 360 means 1 bucket per degree of longitude.
`protected java.util.Collection` | `polar` polar is a bucket for anything that is near enough to either pole to cover more than 1/2 the buckets.

Constructor Summary
`ExtentIndex.AbstractExtentIndex()`
`ExtentIndex.AbstractExtentIndex(double m)`
`ExtentIndex.AbstractExtentIndex(int nb)`
`ExtentIndex.AbstractExtentIndex(int nb, double m)`

Method Summary
`boolean` | `add(java.lang.Object o)` Add an object to the index.
`boolean` | `addExtent(GeoExtent extent)` Method to call to add Region object with BoundingCircle to Collection and organize it for later retrieval.
`protected int` | `bucketFor(double lon)` figure out what bucket a particular longitude goes in.
`void` | `clear()` Method to call to clear out the index.
`double` | `indexHorizontalRange()` RegionIndex parameter method.
`java.util.Iterator` | `iterator()`
`java.util.Iterator` | `iterator(GeoExtent o)` return an iterator listing a subset of the whole collection that is a superset of the actual matches.
`protected java.util.Iterator` | `lookup(double left, double right)` Called when you want everything in each bucket between the coordinates.
`protected java.util.Iterator` | `lookup(double left, double right, BoundingCircle bc)` Called when you want to get the regions in the buckets, but you want to further filter on objects that can intersect based on the bounding circle provided.
`java.util.Iterator` | `lookupByBoundingCircle(BoundingCircle bc)`
`java.util.Iterator` | `lookupByPath(GeoPath path)`
`java.util.Iterator` | `lookupBySegment(GeoSegment segment)`
`protected java.util.Collection` | `makeBucket()`
`protected abstract java.util.Collection` | `makeBucket(int sizeHint)` implement to specify the factory to use to create Bucket storage.
`protected static double` | `normalizeLon(double lon)` normalize longitude to be at least 0.0 and less than 360 *
`protected static double[]` | `normalizeLons(double[] lons)`
`boolean` | `removeExtent(GeoExtent region)` Method to call to remove a region from the index.
`int` | `size()`
`java.lang.String` | `toString()`

Methods inherited from class java.util.AbstractCollection
`addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Methods inherited from interface java.util.Collection
`addAll, contains, containsAll, equals, hashCode, isEmpty, remove, removeAll, retainAll, toArray, toArray`

Field Detail

### D_NBUCKETS

    public static final int D_NBUCKETS

  Default value for #nbuckets if not specified in the call to the constructor.

  See Also:
    Constant Field Values

### D_MARGIN

    public static final double D_MARGIN

  Default value for #margin if not specified in the call to the constructor.

  See Also:
    Constant Field Values

### nbuckets

    public final int nbuckets

  how many buckets in the longitudinal index - 360 means 1 bucket per degree of longitude. More than 360 doesn't seem to add much search speed, less than 180 makes it slower. The sweet spot on current datasets is somewhere in between. If unspecifed, defaults to #D_NBUCKETS

### margin

    public final double margin

  how much of a margin to put around regions for indexing purposes, in nautical miles. This must be at least the largest margin searched for by route (currently 50nmiles) - the larger this value, the larger the average entries/bucket and so, the slower the search. If unspecfied, defaults to #D_MARGIN

### buckets

    protected final java.util.Collection[] buckets

### all

    protected final java.util.Collection all

  all is a collection of everything successfully indexed.

### polar

    protected final java.util.Collection polar

  polar is a bucket for anything that is near enough to either pole to cover more than 1/2 the buckets.

### discarded

    protected final java.util.Collection discarded

Constructor Detail

### ExtentIndex.AbstractExtentIndex

    public ExtentIndex.AbstractExtentIndex()

### ExtentIndex.AbstractExtentIndex

    public ExtentIndex.AbstractExtentIndex(int nb)

### ExtentIndex.AbstractExtentIndex

    public ExtentIndex.AbstractExtentIndex(double m)

### ExtentIndex.AbstractExtentIndex

    public ExtentIndex.AbstractExtentIndex(int nb,
                                           double m)

Method Detail

### makeBucket

    protected final java.util.Collection makeBucket()

### makeBucket

    protected abstract java.util.Collection makeBucket(int sizeHint)

  implement to specify the factory to use to create Bucket storage.

  Parameters:
    `sizeHint` - a guess at the number of elements that are likely to be stored in this bucket or 0 if unknown.
  Returns:
    A Collection instance suitable for use as a bucket

### add

    public boolean add(java.lang.Object o)

  Add an object to the index.

  Specified by:
    `add` in interface `java.util.Collection`
  Returns:
    true if object is a GeoExtent and was added.

### addExtent

    public boolean addExtent(GeoExtent extent)

  Method to call to add Region object with BoundingCircle to Collection and organize it for later retrieval.

  Specified by:
    `addExtent` in interface `ExtentIndex`
  Parameters:
    `extent` - Region to index
  Returns:
    true if object added, false if it's been discarded.

### normalizeLon

    protected static final double normalizeLon(double lon)

  normalize longitude to be at least 0.0 and less than 360 *

### bucketFor

    protected final int bucketFor(double lon)

  figure out what bucket a particular longitude goes in.

### normalizeLons

    protected static final double[] normalizeLons(double[] lons)

### lookup

    protected java.util.Iterator lookup(double left,
                                        double right)

  Called when you want everything in each bucket between the coordinates.

  Parameters:
    `left` - left-most (west) bucket value.
    `right` - right-most (east) bucket value.
  Returns:
    Iterator over regions in buckets that cover range provided.

### lookup

    protected java.util.Iterator lookup(double left,
                                        double right,
                                        BoundingCircle bc)

  Called when you want to get the regions in the buckets, but you want to further filter on objects that can intersect based on the bounding circle provided.

  Parameters:
    `left` - left-most (west) bucket value.
    `right` - right-most (east) bucket value.
    `bc` - Bounding circle to do another filter check, if null, everything in a bucket will be returned.
  Returns:
    Iterator over regions in buckets that cover range provided that intersect with the BoundingCircle (if one is provided).

### removeExtent

    public boolean removeExtent(GeoExtent region)

  Method to call to remove a region from the index.

  Specified by:
    `removeExtent` in interface `ExtentIndex`
  Parameters:
    `region` -
  Returns:
    true if the region was found and removed.

### clear

    public void clear()

  Method to call to clear out the index.

  Specified by:
    `clear` in interface `ExtentIndex`

### indexHorizontalRange

    public double indexHorizontalRange()

  RegionIndex parameter method.

  Specified by:
    `indexHorizontalRange` in interface `ExtentIndex`
  Returns:
    horizontal range in nautical miles for matches.

### lookupBySegment

    public java.util.Iterator lookupBySegment(GeoSegment segment)

### lookupByPath

    public java.util.Iterator lookupByPath(GeoPath path)

### lookupByBoundingCircle

    public java.util.Iterator lookupByBoundingCircle(BoundingCircle bc)

### iterator

    public java.util.Iterator iterator(GeoExtent o)

  Description copied from interface: `ExtentIndex`
  return an iterator listing a subset of the whole collection that is a superset of the actual matches. A valid (but inefficient) implementation would return an iterator over the whole collection. Implementation should match anything that is likely to match - this will generally include, for instance, additional space around the actual segment to accommodate buffer zones around the segment.

  Specified by:
    `iterator` in interface `ExtentIndex`
  Returns:
    an Iterator over BoundingCircle objects in the Collection where the GExtent may be related to them.

### iterator

    public java.util.Iterator iterator()

  Specified by:
    `iterator` in interface `java.util.Collection`
  Returns:
    Iterator over all entries in Collection.

### size

    public int size()

  Specified by:
    `size` in interface `java.util.Collection`
  Returns:
    number of all entries in Collection.

### toString

    public java.lang.String toString()

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

Copyright (C) BBNT Solutions LLC; See http://openmap.bbn.com/ for details