org.axiondb.engine.indexes
Class BaseIndex

java.lang.Object
  extended by org.axiondb.event.BaseTableModificationListener
      extended by org.axiondb.engine.indexes.BaseIndex
All Implemented Interfaces:
TableModificationListener, Index
Direct Known Subclasses:
BaseArrayIndex, BaseBTreeIndex

public abstract class BaseIndex
extends BaseTableModificationListener
implements Index, TableModificationListener

Abstract base implementation of Index.

Version:
$Revision: 1.5 $ $Date: 2005/12/20 18:32:40 $

Field Summary
 
Fields inherited from interface org.axiondb.Index
ARRAY, BTREE, DEFAULT, TTREE
 
Constructor Summary
BaseIndex(String name, Column column, boolean unique)
           
 
Method Summary
protected  Comparator getComparator()
           
protected  DataType getDataType()
           
 Column getIndexedColumn()
          Returns the column I index.
abstract  IndexLoader getIndexLoader()
           
abstract  RowIterator getInorderRowIterator(RowSource source)
          Returns a RowIteratorwhich is inorder traversal of keys,
 String getName()
          Returns my name.
abstract  RowIterator getRowIterator(RowSource source, Function fn, Object value)
          Returns a RowIteratorover the indexed rows, limited by the given ComparisonOperator/value pair, using the default sort order.
 boolean isUnique()
          Whether or not I allow duplicate values.
abstract  void save(File dataDirectory)
           
abstract  void saveAfterTruncate(File dataDirectory)
           
abstract  boolean supportsFunction(Function fn)
          Returns true iff #getRowIterator(org.axiondb.RowSource,org.axiondb.ComparisonOperator,java.lang.Object) can support the given operator, false otherwise.
abstract  void truncate()
           
 
Methods inherited from class org.axiondb.event.BaseTableModificationListener
columnAdded, constraintAdded, constraintRemoved, rowDeleted, rowInserted, rowUpdated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.axiondb.Index
changeRowId, getType
 
Methods inherited from interface org.axiondb.event.TableModificationListener
columnAdded, constraintAdded, constraintRemoved, rowDeleted, rowInserted, rowUpdated
 

Constructor Detail

BaseIndex

public BaseIndex(String name,
                 Column column,
                 boolean unique)
Method Detail

getIndexedColumn

public Column getIndexedColumn()
Description copied from interface: Index
Returns the column I index.

Specified by:
getIndexedColumn in interface Index

getIndexLoader

public abstract IndexLoader getIndexLoader()
Specified by:
getIndexLoader in interface Index

getInorderRowIterator

public abstract RowIterator getInorderRowIterator(RowSource source)
                                           throws AxionException
Description copied from interface: Index
Returns a RowIteratorwhich is inorder traversal of keys,

Specified by:
getInorderRowIterator in interface Index
Parameters:
source - table/view for which we need to get inorder traversal
Returns:
Throws:
AxionException

getName

public String getName()
Description copied from interface: Index
Returns my name.

Specified by:
getName in interface Index

getRowIterator

public abstract RowIterator getRowIterator(RowSource source,
                                           Function fn,
                                           Object value)
                                    throws AxionException
Description copied from interface: Index
Returns a RowIteratorover the indexed rows, limited by the given ComparisonOperator/value pair, using the default sort order.

Specified by:
getRowIterator in interface Index
value - the value to compare the indexed column to
Throws:
AxionException

isUnique

public boolean isUnique()
Description copied from interface: Index
Whether or not I allow duplicate values.

Specified by:
isUnique in interface Index

save

public abstract void save(File dataDirectory)
                   throws AxionException
Specified by:
save in interface Index
Throws:
AxionException

saveAfterTruncate

public abstract void saveAfterTruncate(File dataDirectory)
                                throws AxionException
Specified by:
saveAfterTruncate in interface Index
Throws:
AxionException

supportsFunction

public abstract boolean supportsFunction(Function fn)
Description copied from interface: Index
Returns true iff #getRowIterator(org.axiondb.RowSource,org.axiondb.ComparisonOperator,java.lang.Object) can support the given operator, false otherwise.

Specified by:
supportsFunction in interface Index

truncate

public abstract void truncate()
                       throws AxionException
Specified by:
truncate in interface Index
Throws:
AxionException

getComparator

protected Comparator getComparator()

getDataType

protected DataType getDataType()