|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectags.utils.dataStructures.trees.secondGenKD.KdTree<T>
public abstract class KdTree<T>
An efficient well-optimized kd-tree
Nested Class Summary | |
---|---|
private class |
KdTree.ChildNode
Internal class for child nodes |
static class |
KdTree.DataPoint<T>
A location point and it's value (used for storage of the tree model) |
static class |
KdTree.Entry<T>
Stores a distance and value to output |
static class |
KdTree.Manhattan<T>
Class for tree with Manhattan distancing |
private static class |
KdTree.ResultHeap
Class for tracking up to 'size' closest values |
static class |
KdTree.SqrEuclid<T>
Class for tree with Unweighted Squared Euclidean distancing |
private static class |
KdTree.Status
Enumeration representing the status of a node during the running |
static class |
KdTree.WeightedManhattan<T>
Class for tree with Weighted Manhattan distancing |
static class |
KdTree.WeightedSqrEuclid<T>
Class for tree with Weighted Squared Euclidean distancing |
Field Summary | |
---|---|
private static int |
bucketSize
|
private Object[] |
data
|
private int |
dimensions
|
private KdTree<T> |
left
|
private int |
locationCount
|
private double[][] |
locations
|
private LinkedList<double[]> |
locationStack
|
private double[] |
maxLimit
|
private double[] |
minLimit
|
private KdTree<T> |
parent
|
private KdTree<T> |
right
|
private boolean |
singularity
|
private Integer |
sizeLimit
|
private int |
splitDimension
|
private double |
splitValue
|
private KdTree.Status |
status
|
Constructor Summary | |
---|---|
protected |
KdTree(int dimensions,
Integer sizeLimit)
Construct a RTree with a given number of dimensions and a limit on maxiumum size (after which it throws away old points) |
private |
KdTree(KdTree<T> parent,
boolean right)
Constructor for child nodes. |
Method Summary | |
---|---|
void |
addPoint(double[] location,
T value)
Add a point and associated value to the tree |
private void |
extendBounds(double[] location)
Extends the bounds of this node do include a new location |
private int |
findWidestAxis()
Find the widest axis of the bounds of this node |
protected double |
getAxisWeightHint(int i)
|
List<KdTree.DataPoint<T>> |
getDataPoints()
Traverses the tree and stores all data points in a list. |
List<KdTree.Entry<T>> |
nearestNeighbor(double[] location,
int count,
boolean sequentialSorting)
Calculates the nearest 'count' points to 'location' |
protected abstract double |
pointDist(double[] p1,
double[] p2)
|
protected abstract double |
pointRegionDist(double[] point,
double[] min,
double[] max)
|
private void |
removeOld()
Remove the oldest value from the tree. |
int |
size()
Get the number of points in the tree |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final int bucketSize
private final int dimensions
private final KdTree<T> parent
private final LinkedList<double[]> locationStack
private final Integer sizeLimit
private double[][] locations
private Object[] data
private int locationCount
private KdTree<T> left
private KdTree<T> right
private int splitDimension
private double splitValue
private double[] minLimit
private double[] maxLimit
private boolean singularity
private KdTree.Status status
Constructor Detail |
---|
protected KdTree(int dimensions, Integer sizeLimit)
private KdTree(KdTree<T> parent, boolean right)
Method Detail |
---|
public int size()
public void addPoint(double[] location, T value)
private final void extendBounds(double[] location)
private final int findWidestAxis()
private void removeOld()
public List<KdTree.Entry<T>> nearestNeighbor(double[] location, int count, boolean sequentialSorting)
protected abstract double pointDist(double[] p1, double[] p2)
protected abstract double pointRegionDist(double[] point, double[] min, double[] max)
protected double getAxisWeightHint(int i)
public final List<KdTree.DataPoint<T>> getDataPoints()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |