org.helidb.util.bplus
Class KeyAndValue<K,V>

java.lang.Object
  extended by org.helidb.util.bplus.KeyAndValue<K,V>
Type Parameters:
K - The type of keys in the record.
V - The type of values in the record. For a leaf node record, this is the type of values in the tree. For a non-leaf node record, this is Long.
All Implemented Interfaces:
Comparable<KeyAndValue<K,V>>

public final class KeyAndValue<K,V>
extends Object
implements Comparable<KeyAndValue<K,V>>

A key and a value stored in a B+ Tree record.

Since:
1.0
Author:
Karl Gustafsson
In_jar:
helidb-core

Constructor Summary
KeyAndValue(K key, V value)
          Create a new key-value pair.
KeyAndValue(K key, V value, Comparator<? super K> cmp)
          Create a new key-value pair.
 
Method Summary
 int compareTo(KeyAndValue<K,V> o2)
           
 boolean equals(Object o)
           
 K getKey()
           
 V getValue()
           
 int hashCode()
           
 void setKey(K key)
           
 void setValue(V v)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KeyAndValue

public KeyAndValue(K key,
                   V value,
                   Comparator<? super K> cmp)
Create a new key-value pair. Use the supplied Comparator to make the pair Comparable.

Parameters:
key - The key.
value - The value.
cmp - The comparator. This may be null if the keys are Comparable.

KeyAndValue

public KeyAndValue(K key,
                   V value)
            throws IllegalArgumentException
Create a new key-value pair. The key must be Comparable.

Parameters:
key - The key. Must be Comparable.
value - The value.
Throws:
IllegalArgumentException - If the key is not Comparable.
Method Detail

getKey

public K getKey()

setKey

public void setKey(K key)

getValue

public V getValue()

setValue

public void setValue(V v)

compareTo

public int compareTo(KeyAndValue<K,V> o2)
Specified by:
compareTo in interface Comparable<KeyAndValue<K,V>>

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object