iitb.con.indexing.isam
Class ISAMTree<K extends java.lang.Comparable<K>>

java.lang.Object
  extended by iitb.con.indexing.isam.ISAMTree<K>
All Implemented Interfaces:
IndexTree<K>

public class ISAMTree<K extends java.lang.Comparable<K>>
extends java.lang.Object
implements IndexTree<K>

ISAMTree is index structure to index the instances based on their attribute.

ISAM stands for Indexed Sequential Access Method, a method for indexing data for fast retrieval. In an ISAM system, data is organized into records which are composed of fixed length fields. Records are stored sequentially (as leaf nodes), originally to speed access on a disk. A secondary set of hash tables (non-leaf nodes) contain "pointers" into the leaf-node blocks, allowing individual records to be retrieved without having to search the entire data set.

ISAM is a static indexing structure, works well for the structure involving few updates. That is the reason there is no update method provided. Hence user need to create index again if the data gets changed.


Field Summary
 
Fields inherited from interface iitb.con.indexing.IndexTree
LEAF_EXT, NON_LEAF_EXT
 
Constructor Summary
ISAMTree(java.lang.String fileName, java.lang.String mode)
          Constructs the ISAMTree for the specified index file
 
Method Summary
 void close()
          Closes the index structure files.
 void create(java.util.List<Node<K>> nodes)
          Creates the index file for the give nodes list
 KeyList<K,java.lang.Short> getMetaIndex(K key)
          Returns the meta-index of the index structure.
 int[] getValues(K key)
          Retrieves the values for the specified key
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ISAMTree

public ISAMTree(java.lang.String fileName,
                java.lang.String mode)
         throws java.io.FileNotFoundException,
                java.io.IOException
Constructs the ISAMTree for the specified index file

Parameters:
fileName - index file name
mode - file opening mode (r, rw)
Throws:
java.io.FileNotFoundException - if file not found
java.io.IOException - if file operation fails
Method Detail

close

public void close()
           throws java.io.IOException
Closes the index structure files.

Specified by:
close in interface IndexTree<K extends java.lang.Comparable<K>>
Throws:
java.io.IOException - if the file operation fails

create

public void create(java.util.List<Node<K>> nodes)
            throws java.io.IOException
Creates the index file for the give nodes list

Specified by:
create in interface IndexTree<K extends java.lang.Comparable<K>>
Parameters:
nodes - nodes list - Node
Throws:
java.io.IOException - if file operation fails

getMetaIndex

public KeyList<K,java.lang.Short> getMetaIndex(K key)
                                                                        throws java.io.IOException
Returns the meta-index of the index structure. The meta-index is a basically the non-leaf node of the index tree structure.

Specified by:
getMetaIndex in interface IndexTree<K extends java.lang.Comparable<K>>
Parameters:
key - key of the index structure
Returns:
key-id list ; KeyList
Throws:
java.io.IOException - if the file operation fails

getValues

public int[] getValues(K key)
                throws java.io.IOException
Retrieves the values for the specified key

Specified by:
getValues in interface IndexTree<K extends java.lang.Comparable<K>>
Parameters:
key - key of the index structure
Returns:
matched values for the given key
Throws:
java.io.IOException - if the file operation fails