iitb.con.indexing.isam
Class LeafNode<T extends java.lang.Comparable<T>>

java.lang.Object
  extended by iitb.con.indexing.isam.LeafNode<T>
All Implemented Interfaces:
ItemSerializer<LeafNode<T>>

public class LeafNode<T extends java.lang.Comparable<T>>
extends java.lang.Object
implements ItemSerializer<LeafNode<T>>

Leaf Node of the index tree. A leaf node consists of the key with respective values (instance ids).


Field Summary
 short dataSize
          Size of the leaf node
 int[] instanceId
          Instance ids for the key
 T key
          key of the index structure
 
Constructor Summary
LeafNode()
           
LeafNode(T key)
          Intializes with the key
 
Method Summary
 java.lang.Object attributeDeSerialize(java.nio.ByteBuffer buf, java.lang.Object name)
          Deserializes the specified attribute to object value
 LeafNode<T> deSerialize(java.nio.ByteBuffer buf)
          Deserializes the given bytes into leaf node.
 java.nio.ByteBuffer serialize(LeafNode<T> node)
          Serializes into bytes of the given leaf node.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataSize

public short dataSize
Size of the leaf node


instanceId

public int[] instanceId
Instance ids for the key


key

public T extends java.lang.Comparable<T> key
key of the index structure

Constructor Detail

LeafNode

public LeafNode()

LeafNode

public LeafNode(T key)
Intializes with the key

Parameters:
key - index key
Method Detail

attributeDeSerialize

public java.lang.Object attributeDeSerialize(java.nio.ByteBuffer buf,
                                             java.lang.Object name)
Deserializes the specified attribute to object value

Specified by:
attributeDeSerialize in interface ItemSerializer<LeafNode<T extends java.lang.Comparable<T>>>
Parameters:
buf - bytes as ByteBuffer
name - attribute name
Returns:
deserialized attribute value as Object

deSerialize

public LeafNode<T> deSerialize(java.nio.ByteBuffer buf)
Deserializes the given bytes into leaf node. Format {[Key] : [No. of values] : [value1, value2, ..., valueN]}

Specified by:
deSerialize in interface ItemSerializer<LeafNode<T extends java.lang.Comparable<T>>>
Parameters:
buf - bytes as ByteBuffer
Returns:
leaf node - LeafNode

serialize

public java.nio.ByteBuffer serialize(LeafNode<T> node)
Serializes into bytes of the given leaf node.

Format {[Key] : [No. of values] : [value1, value2, ..., valueN]}

Specified by:
serialize in interface ItemSerializer<LeafNode<T extends java.lang.Comparable<T>>>
Parameters:
node - leaf node - LeafNode
Returns:
serialized node as ByteBuffer