public abstract class BaseArrayIndex extends BaseIndex implements Index
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.Constructor and Description |
---|
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) |
Modifier and Type | Method and Description |
---|---|
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
RowIterator which 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
RowIterator over 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() |
getComparator, getDataType, getIndexedColumn, getName, isUnique
columnAdded, constraintAdded, constraintRemoved
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getIndexedColumn, getName, isUnique
columnAdded, constraintAdded, constraintRemoved
public BaseArrayIndex(java.lang.String name, Column column, boolean unique)
public BaseArrayIndex(java.lang.String name, Column column, boolean unique, org.apache.commons.collections.primitives.IntList values)
public void changeRowId(Table table, Row row, int oldId, int newId) throws AxionException
changeRowId
in interface Index
AxionException
public abstract IndexLoader getIndexLoader()
getIndexLoader
in interface Index
getIndexLoader
in class BaseIndex
public RowIterator getInorderRowIterator(RowSource source) throws AxionException
Index
RowIterator
which is inorder traversal of keys,getInorderRowIterator
in interface Index
getInorderRowIterator
in class BaseIndex
source
- table/view for which we need to get inorder traversalAxionException
public abstract java.util.List getKeyList()
public RowIterator getRowIterator(RowSource source, Function fn, java.lang.Object value) throws AxionException
Index
RowIterator
over the indexed rows, limited by the given
ComparisonOperator
/value pair, using the default sort order.getRowIterator
in interface Index
getRowIterator
in class BaseIndex
value
- the value to compare the indexed column toAxionException
public java.lang.String getType()
Index
public void rowDeleted(RowEvent event) throws AxionException
rowDeleted
in interface TableModificationListener
rowDeleted
in class BaseTableModificationListener
AxionException
public void rowInserted(RowEvent event) throws AxionException
rowInserted
in interface TableModificationListener
rowInserted
in class BaseTableModificationListener
AxionException
public void rowUpdated(RowEvent event) throws AxionException
rowUpdated
in interface TableModificationListener
rowUpdated
in class BaseTableModificationListener
AxionException
public void save(java.io.File dataDirectory) throws AxionException
save
in interface Index
save
in class BaseIndex
AxionException
public void saveAfterTruncate(java.io.File dataDirectory) throws AxionException
saveAfterTruncate
in interface Index
saveAfterTruncate
in class BaseIndex
AxionException
public boolean supportsFunction(Function fn)
Index
#getRowIterator(org.axiondb.RowSource,org.axiondb.ComparisonOperator,java.lang.Object)
can support the given operator, false otherwise.supportsFunction
in interface Index
supportsFunction
in class BaseIndex
public void truncate() throws AxionException
truncate
in interface Index
truncate
in class BaseIndex
AxionException
protected abstract int find(java.lang.Object value, boolean required)
protected abstract java.util.List getKeyList(int minIndex, int maxIndex)
protected org.apache.commons.collections.primitives.IntList getValueList()
protected abstract int insertKey(java.lang.Object value) throws AxionException
AxionException
protected abstract int removeKey(java.lang.Object value) throws AxionException
AxionException
protected abstract void removeKeyAt(int index) throws AxionException
AxionException