org.openmobileis.database.fastobjectdb.db.index
Class FODBIndex

java.lang.Object
  extended byorg.openmobileis.database.fastobjectdb.db.index.FODBIndex
Direct Known Subclasses:
FODBIntIndex, FODBLongIndex, FODBStringIndex

public abstract class FODBIndex
extends java.lang.Object

FODBIndex is an abstract Class on which each type of index will be based.


Field Summary
protected  java.lang.reflect.AccessibleObject accessObj
           
protected  FODBCollectionIndexFile colFile
           
protected  FODBIndexHeader header
           
protected  int minKey
           
static int MULTIPLE
           
protected  java.lang.String name
           
static int UNIQUE
           
 
Constructor Summary
FODBIndex(FODBIndexDescriptor descriptor, FODBCollectionIndexFile cFile, java.lang.reflect.AccessibleObject accObj)
          Constructor of FODBIndex, using an index descriptor.
FODBIndex(FODBIndexHeader newHeader, FODBCollectionIndexFile cFile, java.lang.reflect.AccessibleObject accObj)
          Constructor of FODBIndex, using an index header.
 
Method Summary
 void add(java.lang.Object obj, long pos)
          Add a new pointer in our index.
protected abstract  boolean deleteKey(java.lang.Object obj, long pos)
           
 boolean delObjectWithKey(java.lang.Object obj, long pos)
          Remove a pointer from our index.
 java.lang.Class getAccessObjType()
           
abstract  Array getArrayKey(java.lang.Object obj)
           
abstract  FODBIndexDescriptor getIndexDescriptor()
           
 FODBIndexHeader getIndexHeader()
           
abstract  java.lang.Object getKey(java.lang.Object obj)
           
 java.lang.String getName()
           
 long getPos()
           
abstract  int getType()
           
protected abstract  Node initRoot(FODBIndexDescriptor descriptor)
           
protected abstract  void insertKey(java.lang.Object key, long pos)
           
 boolean isEmpty()
          return true if the index is empty.
abstract  long[] query(SodaIndexComparator comparator)
           
 Node readRoot()
           
protected abstract  void specificDescriptorVerifications(FODBIndexDescriptor descriptor)
           
protected abstract  void specificHeaderInit(FODBIndexDescriptor descriptor)
           
 java.lang.String toString()
          Helps us debugging.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNIQUE

public static final int UNIQUE
See Also:
Constant Field Values

MULTIPLE

public static final int MULTIPLE
See Also:
Constant Field Values

name

protected java.lang.String name

accessObj

protected final java.lang.reflect.AccessibleObject accessObj

colFile

protected FODBCollectionIndexFile colFile

header

protected FODBIndexHeader header

minKey

protected int minKey
Constructor Detail

FODBIndex

public FODBIndex(FODBIndexHeader newHeader,
                 FODBCollectionIndexFile cFile,
                 java.lang.reflect.AccessibleObject accObj)
Constructor of FODBIndex, using an index header. Using an index header, means that we're opening (and not creating) an index.


FODBIndex

public FODBIndex(FODBIndexDescriptor descriptor,
                 FODBCollectionIndexFile cFile,
                 java.lang.reflect.AccessibleObject accObj)
          throws FODBException
Constructor of FODBIndex, using an index descriptor. Using an index descriptor, means that we're creating (and not opening) an index. This is the reason why this constructor is little bit more complicated that the upper one.

Method Detail

readRoot

public Node readRoot()
              throws java.io.IOException,
                     java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

getName

public java.lang.String getName()

getPos

public long getPos()

isEmpty

public boolean isEmpty()
                throws FODBException
return true if the index is empty. throws StoreBTreeException if the index is closed

Throws:
FODBException

add

public void add(java.lang.Object obj,
                long pos)
         throws FODBException
Add a new pointer in our index.

Parameters:
obj - - helps us getting the key.
pos - - position of the element in the collection file.
Throws:
FODBDataFileException
FODBIndexException
BTreeException
FODBException

getAccessObjType

public java.lang.Class getAccessObjType()

delObjectWithKey

public boolean delObjectWithKey(java.lang.Object obj,
                                long pos)
                         throws FODBException
Remove a pointer from our index.

Parameters:
obj - - helps us getting the key.
pos - - position of the element in the collection file.
Returns:
true if the operation succeed, false otherwise.
Throws:
FODBIndexException
FODBException

getIndexHeader

public FODBIndexHeader getIndexHeader()

query

public abstract long[] query(SodaIndexComparator comparator)
                      throws FODBQueryException
Throws:
FODBQueryException

specificDescriptorVerifications

protected abstract void specificDescriptorVerifications(FODBIndexDescriptor descriptor)
                                                 throws FODBException
Throws:
FODBException

initRoot

protected abstract Node initRoot(FODBIndexDescriptor descriptor)
                          throws FODBException
Throws:
FODBException

specificHeaderInit

protected abstract void specificHeaderInit(FODBIndexDescriptor descriptor)
                                    throws FODBException
Throws:
FODBException

getType

public abstract int getType()

insertKey

protected abstract void insertKey(java.lang.Object key,
                                  long pos)
                           throws java.io.IOException,
                                  java.lang.ClassNotFoundException,
                                  FODBException
Throws:
java.io.IOException
java.lang.ClassNotFoundException
FODBException

deleteKey

protected abstract boolean deleteKey(java.lang.Object obj,
                                     long pos)
                              throws java.io.IOException,
                                     java.lang.ClassNotFoundException,
                                     FODBException
Throws:
java.io.IOException
java.lang.ClassNotFoundException
FODBException

getIndexDescriptor

public abstract FODBIndexDescriptor getIndexDescriptor()

getKey

public abstract java.lang.Object getKey(java.lang.Object obj)
                                 throws FODBException
Throws:
FODBException

getArrayKey

public abstract Array getArrayKey(java.lang.Object obj)
                           throws FODBException
Throws:
FODBException

toString

public java.lang.String toString()
Helps us debugging.



Copyright 2005 e-Care. All Rights Reserved.