gov.sandia.cognition.math.geometry
Class KDTree.Neighborhood<VectorType extends Vectorizable,DataType,PairType extends Pair<? extends VectorType,DataType>>

java.lang.Object
  extended by java.util.AbstractCollection<PairType>
      extended by gov.sandia.cognition.math.geometry.KDTree.Neighborhood<VectorType,DataType,PairType>
Type Parameters:
VectorType - Type of Vectorizable.
DataType - Type of output data.
PairType - Type of Pair.
All Implemented Interfaces:
Iterable<PairType>, Collection<PairType>
Enclosing class:
KDTree<VectorType extends Vectorizable,DataType,PairType extends Pair<? extends VectorType,DataType>>

protected static class KDTree.Neighborhood<VectorType extends Vectorizable,DataType,PairType extends Pair<? extends VectorType,DataType>>
extends AbstractCollection<PairType>

A Collection of nearby pairs.


Nested Class Summary
protected  class KDTree.Neighborhood.Neighbor<VectorType extends Vectorizable,DataType,PairType extends Pair<? extends VectorType,DataType>>
          Holds neighbor information used during the evaluate method and is put into a priority queue.
protected  class KDTree.Neighborhood.NeighborhoodIterator
          Iterator for the Neighborhood.
 
Constructor Summary
KDTree.Neighborhood(int k)
          Creates a new Neighborhood.
 
Method Summary
 void add(PairType value, double distance)
          Adds the neighbor to the priority queue.
 double getFurthestNeighborDistance()
          Returns the distance of the furthest Neighbor.
 boolean isFull()
          Returns true if the Neighborhood is full.
 Iterator<PairType> iterator()
           
 boolean offer(PairType value, double distance)
          Offers the neighbor if there is space or it's closer than the furthest neighbor.
 int size()
           
 
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Constructor Detail

KDTree.Neighborhood

public KDTree.Neighborhood(int k)
Creates a new Neighborhood.

Parameters:
k - Maximum number of Neighbors in the Neighborhood.
Method Detail

isFull

public boolean isFull()
Returns true if the Neighborhood is full.

Returns:
True if the Neighborhood is full, false if not full.

getFurthestNeighborDistance

public double getFurthestNeighborDistance()
Returns the distance of the furthest Neighbor.

Returns:
Distance of the furthest Neighbor.

add

public void add(PairType value,
                double distance)
Adds the neighbor to the priority queue.

Parameters:
value - Value to add.
distance - Distance to associate with the neighbor to the queue.

offer

public boolean offer(PairType value,
                     double distance)
Offers the neighbor if there is space or it's closer than the furthest neighbor.

Parameters:
value - Value of the neighbor.
distance - Distance to the key value.
Returns:
True if added, false if not added.

iterator

public Iterator<PairType> iterator()
Specified by:
iterator in interface Iterable<PairType extends Pair<? extends VectorType,DataType>>
Specified by:
iterator in interface Collection<PairType extends Pair<? extends VectorType,DataType>>
Specified by:
iterator in class AbstractCollection<PairType extends Pair<? extends VectorType,DataType>>

size

public int size()
Specified by:
size in interface Collection<PairType extends Pair<? extends VectorType,DataType>>
Specified by:
size in class AbstractCollection<PairType extends Pair<? extends VectorType,DataType>>