iitb.con.indexing
Class IndexBuilder

java.lang.Object
  extended by iitb.con.indexing.IndexBuilder

public class IndexBuilder
extends java.lang.Object

Builds the index for the given set of nodes (Node). The nodes are key-value pair where the key is the attribute of the type and the value is the attribute's value.


Constructor Summary
IndexBuilder()
           
 
Method Summary
static
<K extends java.lang.Comparable<K>>
boolean
createIndex(java.lang.String fileName, java.lang.String mode, java.util.List<Node<K>> nodes)
          Creates the index structure for the given list of nodes
static boolean dropIndex(java.lang.String fileName)
          Drops the index by deleting the index file.
static java.lang.String getIndexFileName(java.lang.Short typeId, java.lang.String attributeName)
          Gets the file name for the index.
static boolean hasIndex(java.lang.Short typeId, java.lang.String attributeName)
          Returns true if index is present for the specified type's attribute
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IndexBuilder

public IndexBuilder()
Method Detail

createIndex

public static <K extends java.lang.Comparable<K>> boolean createIndex(java.lang.String fileName,
                                                                      java.lang.String mode,
                                                                      java.util.List<Node<K>> nodes)
Creates the index structure for the given list of nodes

Type Parameters:
K - data type of the key
Parameters:
fileName - index file name
mode - file mode
nodes - node list
Returns:
true on success
See Also:
Node

dropIndex

public static boolean dropIndex(java.lang.String fileName)
Drops the index by deleting the index file.

Parameters:
fileName - index file name
Returns:
true on success

getIndexFileName

public static java.lang.String getIndexFileName(java.lang.Short typeId,
                                                java.lang.String attributeName)
Gets the file name for the index.

The index file name is created as the string formed of type id and attribute name

Parameters:
typeId - type id
attributeName - attribute name
Returns:
index file name

hasIndex

public static boolean hasIndex(java.lang.Short typeId,
                               java.lang.String attributeName)
Returns true if index is present for the specified type's attribute

Parameters:
typeId - type id
attributeName - attribute name
Returns:
true if index present