org.axiondb.engine.indexes
Class BaseArrayIndex
java.lang.Object
org.axiondb.event.BaseTableModificationListener
org.axiondb.engine.indexes.BaseIndex
org.axiondb.engine.indexes.BaseArrayIndex
- All Implemented Interfaces:
- TableModificationListener, Index
- Direct Known Subclasses:
- IntArrayIndex, ObjectArrayIndex
public abstract class BaseArrayIndex
- extends BaseIndex
- implements Index
Abstract base implemenation for indicesthat maintain an in-memory,
sorted array of key values (and their associated row identifiers). This type of index
is fast to read, relatively slow to write and somewhat memory expensive when very
large.
- Version:
- $Revision: 1.10 $ $Date: 2005/12/20 18:32:30 $
|
Constructor Summary |
BaseArrayIndex(java.lang.String name,
Column column,
boolean unique)
|
BaseArrayIndex(java.lang.String name,
Column column,
boolean unique,
org.apache.commons.collections.primitives.IntList values)
|
|
Method Summary |
void |
changeRowId(Table table,
Row row,
int oldId,
int newId)
|
protected abstract int |
find(java.lang.Object value,
boolean required)
|
abstract IndexLoader |
getIndexLoader()
|
RowIterator |
getInorderRowIterator(RowSource source)
Returns a RowIteratorwhich is inorder traversal of keys, |
abstract java.util.List |
getKeyList()
|
protected abstract java.util.List |
getKeyList(int minIndex,
int maxIndex)
|
RowIterator |
getRowIterator(RowSource source,
Function fn,
java.lang.Object value)
Returns a RowIteratorover the indexed rows, limited by the given
ComparisonOperator/value pair, using the default sort order. |
java.lang.String |
getType()
Returns my type. |
protected org.apache.commons.collections.primitives.IntList |
getValueList()
|
protected abstract int |
insertKey(java.lang.Object value)
|
protected abstract int |
removeKey(java.lang.Object value)
|
protected abstract void |
removeKeyAt(int index)
|
void |
rowDeleted(RowEvent event)
|
void |
rowInserted(RowEvent event)
|
void |
rowUpdated(RowEvent event)
|
void |
save(java.io.File dataDirectory)
|
void |
saveAfterTruncate(java.io.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 class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BaseArrayIndex
public BaseArrayIndex(java.lang.String name,
Column column,
boolean unique)
BaseArrayIndex
public BaseArrayIndex(java.lang.String name,
Column column,
boolean unique,
org.apache.commons.collections.primitives.IntList values)
changeRowId
public void changeRowId(Table table,
Row row,
int oldId,
int newId)
throws AxionException
- Specified by:
changeRowId in interface Index
- Throws:
AxionException
getIndexLoader
public abstract IndexLoader getIndexLoader()
- Specified by:
getIndexLoader in interface Index- Specified by:
getIndexLoader in class BaseIndex
getInorderRowIterator
public 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- Specified by:
getInorderRowIterator in class BaseIndex
- Parameters:
source - table/view for which we need to get inorder traversal
- Returns:
-
- Throws:
AxionException
getKeyList
public abstract java.util.List getKeyList()
getRowIterator
public RowIterator getRowIterator(RowSource source,
Function fn,
java.lang.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- Specified by:
getRowIterator in class BaseIndex
value - the value to compare the indexed column to
- Throws:
AxionException
getType
public java.lang.String getType()
- Description copied from interface:
Index
- Returns my type.
- Specified by:
getType in interface Index
rowDeleted
public void rowDeleted(RowEvent event)
throws AxionException
- Specified by:
rowDeleted in interface TableModificationListener- Overrides:
rowDeleted in class BaseTableModificationListener
- Throws:
AxionException
rowInserted
public void rowInserted(RowEvent event)
throws AxionException
- Specified by:
rowInserted in interface TableModificationListener- Overrides:
rowInserted in class BaseTableModificationListener
- Throws:
AxionException
rowUpdated
public void rowUpdated(RowEvent event)
throws AxionException
- Specified by:
rowUpdated in interface TableModificationListener- Overrides:
rowUpdated in class BaseTableModificationListener
- Throws:
AxionException
save
public void save(java.io.File dataDirectory)
throws AxionException
- Specified by:
save in interface Index- Specified by:
save in class BaseIndex
- Throws:
AxionException
saveAfterTruncate
public void saveAfterTruncate(java.io.File dataDirectory)
throws AxionException
- Specified by:
saveAfterTruncate in interface Index- Specified by:
saveAfterTruncate in class BaseIndex
- Throws:
AxionException
supportsFunction
public 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- Specified by:
supportsFunction in class BaseIndex
truncate
public void truncate()
throws AxionException
- Specified by:
truncate in interface Index- Specified by:
truncate in class BaseIndex
- Throws:
AxionException
find
protected abstract int find(java.lang.Object value,
boolean required)
getKeyList
protected abstract java.util.List getKeyList(int minIndex,
int maxIndex)
getValueList
protected org.apache.commons.collections.primitives.IntList getValueList()
insertKey
protected abstract int insertKey(java.lang.Object value)
throws AxionException
- Throws:
AxionException
removeKey
protected abstract int removeKey(java.lang.Object value)
throws AxionException
- Throws:
AxionException
removeKeyAt
protected abstract void removeKeyAt(int index)
throws AxionException
- Throws:
AxionException