org.knime.base.util.kdtree
Class KDTreeBuilder<T>

java.lang.Object
  extended by org.knime.base.util.kdtree.KDTreeBuilder<T>
Type Parameters:
T - the type of the data stored inside the tree

public class KDTreeBuilder<T>
extends Object

This class is some kind of factory for the KDTree. Because an optimized k-d tree needs to inspect all nodes upon building the node, the builder first collects all patterns and then builds the tree.

Author:
Thorsten Meinl, University of Konstanz

Field Summary
static int DEFAULT_BUCKET_SIZE
          The default number of patterns inside a terminal node.
 
Constructor Summary
KDTreeBuilder(int k)
          Creates a new k-d tree builder.
 
Method Summary
 void addPattern(double[] pattern, T data)
          Adds a pattern that is later inserted into the tree.
 KDTree<T> buildTree()
          Builds a k-d tree using all the patterns that have been added to the builder so far.
 KDTree<T> buildTree(ExecutionMonitor progMon)
          Builds a k-d tree using all the patterns that have been added to the builder so far.
 KDTree<T> buildTree(int bucketSize)
          Builds a k-d tree using all the patterns that have been added to the builder so far.
 KDTree<T> buildTree(int bucketSize, ExecutionMonitor progMon)
          Builds a k-d tree using all the patterns that have been added to the builder so far.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_BUCKET_SIZE

public static final int DEFAULT_BUCKET_SIZE
The default number of patterns inside a terminal node.

See Also:
Constant Field Values
Constructor Detail

KDTreeBuilder

public KDTreeBuilder(int k)
Creates a new k-d tree builder.

Parameters:
k - the dimensionality of the stored patterns
Method Detail

addPattern

public void addPattern(double[] pattern,
                       T data)
Adds a pattern that is later inserted into the tree.

Parameters:
pattern - the pattern; the length of the array must be the same as the number specified when the builder was created
data - (optional) data associated with the pattern

buildTree

public KDTree<T> buildTree()
Builds a k-d tree using all the patterns that have been added to the builder so far.

Returns:
an optimized k-d tree

buildTree

public KDTree<T> buildTree(int bucketSize,
                           ExecutionMonitor progMon)
                    throws CanceledExecutionException
Builds a k-d tree using all the patterns that have been added to the builder so far.

Parameters:
bucketSize - the number of patterns inside the terminal nodes
progMon - an optional progress monitor, can be null
Returns:
ann optimized k-d tree
Throws:
CanceledExecutionException - if the execution has been canceled

buildTree

public KDTree<T> buildTree(ExecutionMonitor progMon)
                    throws CanceledExecutionException
Builds a k-d tree using all the patterns that have been added to the builder so far.

Parameters:
progMon - an optional progress monitor, can be null
Returns:
an optimized k-d tree
Throws:
CanceledExecutionException - if the execution has been canceled

buildTree

public KDTree<T> buildTree(int bucketSize)
Builds a k-d tree using all the patterns that have been added to the builder so far.

Parameters:
bucketSize - the number of patterns inside the terminal nodes
Returns:
ann optimized k-d tree


Copyright, 2003 - 2010. All rights reserved.
University of Konstanz, Germany.
Chair for Bioinformatics and Information Mining, Prof. Dr. Michael R. Berthold.
You may not modify, publish, transmit, transfer or sell, reproduce, create derivative works from, distribute, perform, display, or in any way exploit any of the content, in whole or in part, except as otherwise expressly permitted in writing by the copyright owner or as specified in the license file distributed with this product.