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.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 Object
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
private  K key
          The key of this heap node.
private  V value
          The value of this heap node.
 
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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

key

private K extends Comparable<K> key
The key of this heap node.


value

private V extends Identifiable value
The value of this heap node.

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 Object
Returns:
a string representation of this heap node

Release 0.2 (2009-07-06_1820)