goldman.collection.tagged.spatial
Class TaggedSpatialCollectionWrapper<T,E>

java.lang.Object
  extended by goldman.collection.tagged.TaggedCollectionWrapper<T,E>
      extended by goldman.collection.tagged.spatial.TaggedSpatialCollectionWrapper<T,E>
All Implemented Interfaces:
TaggedSpatialCollection<T,E>, TaggedCollection<T,E>, Iterable<TaggedElement<T,E>>
Direct Known Subclasses:
TaggedKDTree, TaggedQuadTree

public abstract class TaggedSpatialCollectionWrapper<T,E>
extends TaggedCollectionWrapper<T,E>
implements TaggedSpatialCollection<T,E>

The tagged spatial collection wrapper can wrap any spatial collection implementation, where each element in the collection is a tagged element. It is required that the comparator(s) depend(s) only on the tag, and the tag is immutable.


Field Summary
protected  MutableTaggedElement<T,E> anchor
          Since a target region is specified by two corners (each a d-dimensional point), we use a second mutable tagged element anchor to specify the second corner of a bounding box in an orthogonal range query where target specifies the other corner.
 
Fields inherited from class goldman.collection.tagged.TaggedCollectionWrapper
pairs, target
 
Constructor Summary
TaggedSpatialCollectionWrapper(Collection<TaggedElement<T,E>> pairs)
           
 
Method Summary
 TaggedElement<T,E> max(int dimension)
          Returns a tagged element for the greatest tag in the collection (according to the comparator) in the given dimension.
 TaggedElement<T,E> min(int dimension)
          Returns a tagged element for the least tag in the collection (according to the comparator) along the given dimension.
 Collection<TaggedElement<T,E>> withinBounds(T minCorner, T maxCorner)
          Returns a collection of the tagged elements for which the tag fall within (or on) the boundary of the multidimensional box defined by the two given corners, minCorner and maxCorner.
 
Methods inherited from class goldman.collection.tagged.TaggedCollectionWrapper
accept, clear, contains, elements, ensureCapacity, get, getCapacity, getLocator, getSize, isEmpty, iterator, put, putAll, remove, tags, toString, trimToSize, values
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface goldman.collection.tagged.TaggedCollection
accept, clear, contains, elements, ensureCapacity, get, getCapacity, getLocator, getSize, isEmpty, iterator, put, putAll, remove, tags, toString, trimToSize, values
 

Field Detail

anchor

protected MutableTaggedElement<T,E> anchor
Since a target region is specified by two corners (each a d-dimensional point), we use a second mutable tagged element anchor to specify the second corner of a bounding box in an orthogonal range query where target specifies the other corner.

Constructor Detail

TaggedSpatialCollectionWrapper

public TaggedSpatialCollectionWrapper(Collection<TaggedElement<T,E>> pairs)
Method Detail

min

public TaggedElement<T,E> min(int dimension)
Description copied from interface: TaggedSpatialCollection
Returns a tagged element for the least tag in the collection (according to the comparator) along the given dimension. It throws a NoSuchElementException when the collection is empty.

Specified by:
min in interface TaggedSpatialCollection<T,E>
Returns:
a tagged element associated with the largest tag in the collection.
Throws:
NoSuchElementException - the collection is empty.

max

public TaggedElement<T,E> max(int dimension)
Description copied from interface: TaggedSpatialCollection
Returns a tagged element for the greatest tag in the collection (according to the comparator) in the given dimension. It throws a NoSuchElementException when the collection is empty.

Specified by:
max in interface TaggedSpatialCollection<T,E>
Returns:
a tagged element associated with the largest tag in the collection.
Throws:
NoSuchElementException - the collection is empty.

withinBounds

public Collection<TaggedElement<T,E>> withinBounds(T minCorner,
                                                   T maxCorner)
Description copied from interface: TaggedSpatialCollection
Returns a collection of the tagged elements for which the tag fall within (or on) the boundary of the multidimensional box defined by the two given corners, minCorner and maxCorner. The method requires that the coordinates of minCorner are less than or equal to those of maxCorner along every dimension of the spatial collection.

Specified by:
withinBounds in interface TaggedSpatialCollection<T,E>
Parameters:
minCorner - the bottom left corner of the target box
maxCorner - the upper right corner of the target box
Returns:
a collection of all tagged elements for which the tag is within (or on) the target box