org.axiondb
Interface Index

All Superinterfaces:
TableModificationListener
All Known Implementing Classes:
BaseArrayIndex, BaseBTreeIndex, BaseIndex, IntArrayIndex, IntBTreeIndex, ObjectArrayIndex, ObjectBTreeIndex, StringBTreeIndex

public interface Index
extends TableModificationListener

A database index. (Right now, this class assumes an Index over a single column. Multipart indices will come later.)

TODO: Support expression and/or function e.g UPPER(name)
TODO: Support for Multi column index, very useful for composite keys

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

Field Summary
static String ARRAY
           
static String BTREE
           
static String DEFAULT
           
static String TTREE
           
 
Method Summary
 void changeRowId(Table table, Row row, int oldId, int newId)
           
 Column getIndexedColumn()
          Returns the column I index.
 IndexLoader getIndexLoader()
           
 RowIterator getInorderRowIterator(RowSource source)
          Returns a RowIteratorwhich is inorder traversal of keys,
 String getName()
          Returns my name.
 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.
 String getType()
          Returns my type.
 boolean isUnique()
          Whether or not I allow duplicate values.
 void save(File dataDirectory)
           
 void saveAfterTruncate(File dataDirectory)
           
 boolean supportsFunction(Function fn)
          Returns true iff #getRowIterator(org.axiondb.RowSource,org.axiondb.ComparisonOperator,java.lang.Object) can support the given operator, false otherwise.
 void truncate()
           
 
Methods inherited from interface org.axiondb.event.TableModificationListener
columnAdded, constraintAdded, constraintRemoved, rowDeleted, rowInserted, rowUpdated
 

Field Detail

ARRAY

static final String ARRAY
See Also:
Constant Field Values

BTREE

static final String BTREE
See Also:
Constant Field Values

DEFAULT

static final String DEFAULT
See Also:
Constant Field Values

TTREE

static final String TTREE
See Also:
Constant Field Values
Method Detail

changeRowId

void changeRowId(Table table,
                 Row row,
                 int oldId,
                 int newId)
                 throws AxionException
Throws:
AxionException

getIndexedColumn

Column getIndexedColumn()
Returns the column I index.


getIndexLoader

IndexLoader getIndexLoader()

getInorderRowIterator

RowIterator getInorderRowIterator(RowSource source)
                                  throws AxionException
Returns a RowIteratorwhich is inorder traversal of keys,

Parameters:
source - table/view for which we need to get inorder traversal
Returns:
Throws:
AxionException

getName

String getName()
Returns my name.


getRowIterator

RowIterator getRowIterator(RowSource source,
                           Function fn,
                           Object value)
                           throws AxionException
Returns a RowIteratorover the indexed rows, limited by the given ComparisonOperator/value pair, using the default sort order.

Parameters:
operator - the ComparisonOperatorto apply
value - the value to compare the indexed column to
Throws:
AxionException

getType

String getType()
Returns my type.


isUnique

boolean isUnique()
Whether or not I allow duplicate values.


save

void save(File dataDirectory)
          throws AxionException
Throws:
AxionException

saveAfterTruncate

void saveAfterTruncate(File dataDirectory)
                       throws AxionException
Throws:
AxionException

supportsFunction

boolean supportsFunction(Function fn)
Returns true iff #getRowIterator(org.axiondb.RowSource,org.axiondb.ComparisonOperator,java.lang.Object) can support the given operator, false otherwise.


truncate

void truncate()
              throws AxionException
Throws:
AxionException