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

java.lang.Object
  extended by org.knime.base.util.kdtree.TerminalNode<T>
Type Parameters:
T - the type of the data object object associated with the pattern
All Implemented Interfaces:
Node

final class TerminalNode<T>
extends Object
implements Node

This class represents a terminal node inside a k-d tree. The terminal nodes store the pattern and an optional data object associated with the pattern.

Author:
Thorsten Meinl, University of Konstanz

Constructor Summary
TerminalNode(double[] pattern, T data)
          Creates a new terminal node.
 
Method Summary
 T getData()
          Returns the optional data object.
 double getDistance(double[] query)
          Returns the (squared euclidean) distance to a query pattern.
 double[] getPattern()
          Returns the pattern stored in the terminal node.
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TerminalNode

public TerminalNode(double[] pattern,
                    T data)
Creates a new terminal node.

Parameters:
pattern - the pattern
data - an optional data object
Method Detail

getData

public T getData()
Returns the optional data object. Can be null.

Returns:
the data object

getPattern

public double[] getPattern()
Returns the pattern stored in the terminal node.

Returns:
the pattern

getDistance

public double getDistance(double[] query)
Returns the (squared euclidean) distance to a query pattern. The query pattern must have the same dimension as the pattern inside this node.

Parameters:
query - a query pattern.
Returns:
the distance

toString

public String toString()

Overrides:
toString in class Object


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.