|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.AbstractCollection com.bbn.openmap.geo.ExtentIndex.AbstractExtentIndex
public abstract static class ExtentIndex.AbstractExtentIndex
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/interfaces inherited from interface 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 |
---|
public static final int D_NBUCKETS
public static final double D_MARGIN
public final int nbuckets
public final double margin
protected final java.util.Collection[] buckets
protected final java.util.Collection all
protected final java.util.Collection polar
protected final java.util.Collection discarded
Constructor Detail |
---|
public ExtentIndex.AbstractExtentIndex()
public ExtentIndex.AbstractExtentIndex(int nb)
public ExtentIndex.AbstractExtentIndex(double m)
public ExtentIndex.AbstractExtentIndex(int nb, double m)
Method Detail |
---|
protected final java.util.Collection makeBucket()
protected abstract java.util.Collection makeBucket(int sizeHint)
sizeHint
- a guess at the number of elements that are likely to
be stored in this bucket or 0 if unknown.
public boolean add(java.lang.Object o)
add
in interface java.util.Collection
add
in class java.util.AbstractCollection
public boolean addExtent(GeoExtent extent)
addExtent
in interface ExtentIndex
extent
- Region to index
protected static final double normalizeLon(double lon)
protected final int bucketFor(double lon)
protected static final double[] normalizeLons(double[] lons)
protected java.util.Iterator lookup(double left, double right)
left
- left-most (west) bucket value.right
- right-most (east) bucket value.
protected java.util.Iterator lookup(double left, double right, BoundingCircle bc)
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.
public boolean removeExtent(GeoExtent region)
removeExtent
in interface ExtentIndex
public void clear()
clear
in interface ExtentIndex
clear
in interface java.util.Collection
clear
in class java.util.AbstractCollection
public double indexHorizontalRange()
indexHorizontalRange
in interface ExtentIndex
public java.util.Iterator lookupBySegment(GeoSegment segment)
public java.util.Iterator lookupByPath(GeoPath path)
public java.util.Iterator lookupByBoundingCircle(BoundingCircle bc)
public java.util.Iterator iterator(GeoExtent o)
ExtentIndex
iterator
in interface ExtentIndex
public java.util.Iterator iterator()
iterator
in interface java.lang.Iterable
iterator
in interface java.util.Collection
iterator
in class java.util.AbstractCollection
public int size()
size
in interface java.util.Collection
size
in class java.util.AbstractCollection
public java.lang.String toString()
toString
in class java.util.AbstractCollection
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |