Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities.heap
Class DefaultHeapNode<K extends Comparable<K>,V extends Identifiable>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.pairs.Pair<K,V>
      extended by de.lmu.ifi.dbs.elki.utilities.heap.DefaultHeapNode<K,V>
Type Parameters:
K - Key type
V - Value type
All Implemented Interfaces:
HeapNode<K,V>, Serializable, Comparable<HeapNode<K,V>>
Direct Known Subclasses:
PQNode

public class DefaultHeapNode<K extends Comparable<K>,V extends Identifiable>
extends Pair<K,V>
implements HeapNode<K,V>

A default implementation of an object that can be stored in a heap.

Author:
Elke Achtert
See Also:
Serialized Form

Field Summary
 
Fields inherited from class de.lmu.ifi.dbs.elki.utilities.pairs.Pair
first, second
 
Constructor Summary
DefaultHeapNode()
          Empty constructor for serialization purposes.
DefaultHeapNode(K key, V value)
          Creates a new heap node with the specified parameters.
 
Method Summary
 int compareTo(HeapNode<K,V> heapNode)
          Compares this HeapNode with the specified HeapNode.
 K getKey()
          Returns the key of this heap node.
 V getValue()
          Returns the value of this heap node.
 void setKey(K key)
          Sets the key of this HeapNode.
 void setValue(V value)
          Sets the value of this HeapNode.
 String toString()
          Returns a string representation of this heap node.
 
Methods inherited from class de.lmu.ifi.dbs.elki.utilities.pairs.Pair
equals, getFirst, getSecond, hashCode, newPairArray, setFirst, setSecond
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DefaultHeapNode

public DefaultHeapNode()
Empty constructor for serialization purposes.


DefaultHeapNode

public DefaultHeapNode(K key,
                       V value)
Creates a new heap node with the specified parameters.

Parameters:
key - the key of this heap node
value - the value of this heap node
Method Detail

compareTo

public int compareTo(HeapNode<K,V> heapNode)
Compares this HeapNode with the specified HeapNode.

Specified by:
compareTo in interface Comparable<HeapNode<K extends Comparable<K>,V extends Identifiable>>
Parameters:
heapNode - HeapNode to be compared
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

getValue

public V getValue()
Returns the value of this heap node.

Specified by:
getValue in interface HeapNode<K extends Comparable<K>,V extends Identifiable>
Returns:
the value of this heap node

setValue

public void setValue(V value)
Sets the value of this HeapNode.

Specified by:
setValue in interface HeapNode<K extends Comparable<K>,V extends Identifiable>
Parameters:
value - the value to be set

getKey

public K getKey()
Returns the key of this heap node.

Specified by:
getKey in interface HeapNode<K extends Comparable<K>,V extends Identifiable>
Returns:
the key of this heap node

setKey

public void setKey(K key)
Sets the key of this HeapNode.

Specified by:
setKey in interface HeapNode<K extends Comparable<K>,V extends Identifiable>
Parameters:
key - the key to be set

toString

public String toString()
Returns a string representation of this heap node.

Overrides:
toString in class Pair<K extends Comparable<K>,V extends Identifiable>
Returns:
a string representation of this heap node

Release 0.3 (2010-03-31_1612)