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 indices
that 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.5 $ $Date: 2004/09/09 23:47:46 $
Method Summary |
void |
changeRowId(Table table,
Row row,
int oldId,
int newId)
|
protected abstract int |
find(Object value,
boolean required)
|
abstract IndexLoader |
getIndexLoader()
|
RowIterator |
getInorderRowIterator(RowSource source)
Returns a RowIterator which is inorder traversal of keys, |
abstract List |
getKeyList()
|
protected abstract List |
getKeyList(int minIndex,
int maxIndex)
|
RowIterator |
getRowIterator(RowSource source,
Function fn,
Object value)
Returns a RowIterator over the indexed rows, limited by the given
ComparisonOperator /value pair, using the default sort order. |
String |
getType()
Returns my type. |
protected org.apache.commons.collections.primitives.IntList |
getValueList()
|
protected abstract int |
insertKey(Object value)
|
protected abstract int |
removeKey(Object value)
|
protected abstract void |
removeKeyAt(int index)
|
void |
rowDeleted(RowEvent event)
|
void |
rowInserted(RowEvent event)
|
void |
rowUpdated(RowEvent event)
|
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 class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BaseArrayIndex
public BaseArrayIndex(String name,
Column column,
boolean unique)
BaseArrayIndex
public BaseArrayIndex(String name,
Column column,
boolean unique,
org.apache.commons.collections.primitives.IntList values)
getIndexLoader
public abstract IndexLoader getIndexLoader()
- Specified by:
getIndexLoader
in interface Index
- Specified by:
getIndexLoader
in class BaseIndex
find
protected abstract int find(Object value,
boolean required)
insertKey
protected abstract int insertKey(Object value)
throws AxionException
- Throws:
AxionException
removeKey
protected abstract int removeKey(Object value)
throws AxionException
- Throws:
AxionException
removeKeyAt
protected abstract void removeKeyAt(int index)
throws AxionException
- Throws:
AxionException
getKeyList
public abstract List getKeyList()
getKeyList
protected abstract List getKeyList(int minIndex,
int maxIndex)
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
getRowIterator
public RowIterator getRowIterator(RowSource source,
Function fn,
Object value)
throws AxionException
- Description copied from interface:
Index
- Returns a
RowIterator
over 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
getInorderRowIterator
public RowIterator getInorderRowIterator(RowSource source)
throws AxionException
- Description copied from interface:
Index
- Returns a
RowIterator
which 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
- Throws:
AxionException
rowInserted
public void rowInserted(RowEvent event)
throws AxionException
- Specified by:
rowInserted
in interface TableModificationListener
- Overrides:
rowInserted
in class BaseTableModificationListener
- Throws:
AxionException
rowDeleted
public void rowDeleted(RowEvent event)
throws AxionException
- Specified by:
rowDeleted
in interface TableModificationListener
- Overrides:
rowDeleted
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(File dataDirectory)
throws AxionException
- Specified by:
save
in interface Index
- Specified by:
save
in class BaseIndex
- Throws:
AxionException
saveAfterTruncate
public void saveAfterTruncate(File dataDirectory)
throws AxionException
- Specified by:
saveAfterTruncate
in interface Index
- Specified by:
saveAfterTruncate
in class BaseIndex
- Throws:
AxionException
getValueList
protected org.apache.commons.collections.primitives.IntList getValueList()
changeRowId
public void changeRowId(Table table,
Row row,
int oldId,
int newId)
throws AxionException
- Specified by:
changeRowId
in interface Index
- Throws:
AxionException
truncate
public void truncate()
throws AxionException
- Specified by:
truncate
in interface Index
- Specified by:
truncate
in class BaseIndex
- Throws:
AxionException
getType
public String getType()
- Description copied from interface:
Index
- Returns my type.
- Specified by:
getType
in interface Index