public class FSIndexRepositoryImpl extends Object implements FSIndexRepositoryMgr, LowLevelIndexRepository
Modifier and Type | Class and Description |
---|---|
static class |
FSIndexRepositoryImpl.IteratorExtraFunction
Kinds of extra functions for iterators
|
Modifier and Type | Field and Description |
---|---|
static String |
ALLOW_DUP_ADD_TO_INDEXES
Define this JVM property to allow adding the same identical FS to Set and Sorted indexes more than once.
|
static int |
DEFAULT_INDEX_SIZE
The default size of an index.
|
static String |
DISABLE_ENHANCED_WRONG_INDEX |
static boolean |
IS_ALLOW_DUP_ADD_2_INDEXES |
Modifier and Type | Method and Description |
---|---|
void |
addFS(FeatureStructure fs)
Add a feature structure to all appropriate indexes in the repository.
|
void |
addFS(int fsRef) |
void |
commit()
Commit this repository instance.
|
FSIndexComparator |
createComparator()
Create a new comparator to define a new index.
|
boolean |
createIndex(FSIndexComparator comp,
String label)
Create a new sorted index.
|
boolean |
createIndex(FSIndexComparator comp,
String label,
int indexType)
Create a new index.
|
boolean |
createIndexNoQuestionsAsked(FSIndexComparator comp,
String label,
int indexType)
This is public only until the xml specifier format supports specifying index kinds (set, bag
etc.).
|
LinearTypeOrderBuilder |
createTypeSortOrder()
Currently not useful.
|
void |
flush()
Reset all indexes, in one view.
|
int[] |
getAddedFSs() |
<T extends FeatureStructure> |
getAllIndexedFS(Type type)
Gets an iterator over all indexed FeatureStructures of the specified Type (and any of its
subtypes).
|
LinearTypeOrderBuilder |
getDefaultOrderBuilder()
Get the default type order builder.
|
LinearTypeOrder |
getDefaultTypeOrder()
Get the default type order.
|
int[] |
getDeletedFSs() |
<T extends FeatureStructure> |
getIndex(String label)
Retrieve an index according to a label.
|
<T extends FeatureStructure> |
getIndex(String label,
Type type)
Retrieve an index according to a label and a type.
|
int[] |
getIndexedFSs()
For one particular view (the one associated with this instance of FsIndexRepositoryImpl),
return an array containing all FSs in any defined index, in this view.
|
Iterator<FSIndex<FeatureStructure>> |
getIndexes()
Get all indexes in this repository.
|
int |
getIndexSize(Type type) |
org.apache.uima.internal.util.IntPointerIterator |
getIntIteratorForIndex(String label) |
org.apache.uima.internal.util.IntPointerIterator |
getIntIteratorForIndex(String label,
Type type) |
Iterator<String> |
getLabels()
Get all labels for all indexes.
|
Iterator<String> |
getLabels(FSIndexComparator comp)
Get the labels for a specific comparator.
|
int[] |
getReindexedFSs() |
int[] |
getUpdatedFSs(org.apache.uima.internal.util.PositiveIntSet items) |
boolean |
isCommitted()
Check if this instance has been committed.
|
boolean |
isInSetOrSortedIndexInThisView(int fsAddr)
This is used to see if a FS which has a key feature being modified
could corrupt an index in this view.
|
boolean |
isModified() |
void |
ll_addback(int fsRef,
int count) |
void |
ll_addFS(int fsRef)
Add a FS reference to all appropriate indexes in the repository.
|
void |
ll_addFS(int fsRef,
boolean doChecks)
Add a FS reference to all appropriate indexes in the repository.
|
LowLevelIterator |
ll_getAllIndexedFS(Type type) |
LowLevelIndex |
ll_getIndex(String indexName)
Get an index by its name.
|
LowLevelIndex |
ll_getIndex(String indexName,
int typeCode)
Get an index by a name and type.
|
Iterator<LowLevelIndex> |
ll_getIndexes()
Get all indexes in this repository as low level indexes
|
void |
ll_removeFS(int fsRef)
Remove a FS reference from all indexes in the repository.
|
void |
removeAllExcludingSubtypes(Type type)
Remove all instances of a particular type (but not its subtypes) from all indexes
|
void |
removeAllIncludingSubtypes(Type type)
Remove all instances of a particular type (including its subtypes) from all indexes
|
void |
removeFS(FeatureStructure fs)
Remove a feature structure from all indexes in the repository.
|
void |
removeFS(int fsRef) |
String |
toString() |
public static final int DEFAULT_INDEX_SIZE
public static final String ALLOW_DUP_ADD_TO_INDEXES
public static final boolean IS_ALLOW_DUP_ADD_2_INDEXES
public static final String DISABLE_ENHANCED_WRONG_INDEX
public void flush()
public void addFS(int fsRef)
public void commit()
FSIndexRepositoryMgr
commit
in interface FSIndexRepositoryMgr
FSIndexRepositoryMgr.commit()
public LinearTypeOrder getDefaultTypeOrder()
FSIndexRepositoryMgr
getDefaultTypeOrder
in interface FSIndexRepositoryMgr
public LinearTypeOrderBuilder getDefaultOrderBuilder()
FSIndexRepositoryMgr
getDefaultOrderBuilder
in interface FSIndexRepositoryMgr
public boolean createIndex(FSIndexComparator comp, String label, int indexType) throws CASAdminException
FSIndexRepositoryMgr
createIndex
in interface FSIndexRepositoryMgr
comp
- The comparator for the new index.label
- The name of the new index.indexType
- The kind of index (sorted, set, bag).false
iff an index with the samelabel
already exists.CASAdminException
- If the repository is locked (after calling commit()
).FSIndexRepositoryMgr.createIndex(FSIndexComparator, String)
public boolean createIndexNoQuestionsAsked(FSIndexComparator comp, String label, int indexType)
comp
- -label
- -indexType
- -public Iterator<FSIndex<FeatureStructure>> getIndexes()
FSIndexRepository
getIndexes
in interface FSIndexRepository
FSIndexRepository.getIndexes()
public Iterator<LowLevelIndex> ll_getIndexes()
FSIndexRepository
ll_getIndexes
in interface FSIndexRepository
public Iterator<String> getLabels()
FSIndexRepository
getLabels
in interface FSIndexRepository
FSIndexRepository.getLabels()
public Iterator<String> getLabels(FSIndexComparator comp)
comp
- The comparator.public <T extends FeatureStructure> FSIndex<T> getIndex(String label, Type type)
FSIndexRepository
getIndex
in interface FSIndexRepository
T
- The Java class associated with the typelabel
- The name of the index.type
- A subtype of the type of the index.null
if an index with that name doesn't exist.FSIndexRepository.getIndex(String, Type)
public <T extends FeatureStructure> FSIndex<T> getIndex(String label)
FSIndexRepository
getIndex
in interface FSIndexRepository
T
- the Java class associated with the top-most type of the indexlabel
- The name of the index.label
, or null
if no such index
is defined.FSIndexRepository.getIndex(String)
public org.apache.uima.internal.util.IntPointerIterator getIntIteratorForIndex(String label)
public org.apache.uima.internal.util.IntPointerIterator getIntIteratorForIndex(String label, Type type)
public int getIndexSize(Type type)
public void removeAllExcludingSubtypes(Type type)
removeAllExcludingSubtypes
in interface FSIndexRepository
type
- -public void removeAllIncludingSubtypes(Type type)
removeAllIncludingSubtypes
in interface FSIndexRepository
type
- -public FSIndexComparator createComparator()
FSIndexRepositoryMgr
createComparator
in interface FSIndexRepositoryMgr
FSIndexRepositoryMgr.createComparator()
public boolean isCommitted()
FSIndexRepositoryMgr
isCommitted
in interface FSIndexRepositoryMgr
true
iff this instance has been committed.FSIndexRepositoryMgr.isCommitted()
public boolean createIndex(FSIndexComparator comp, String label) throws CASAdminException
FSIndexRepositoryMgr
createIndex
in interface FSIndexRepositoryMgr
comp
- The comparator for the new index.label
- The name of the new index.false
iff an index with the samelabel
already exists.CASAdminException
- If the repository is locked (after calling commit()
).FSIndexRepositoryMgr.createIndex(org.apache.uima.cas.admin.FSIndexComparator,
java.lang.String)
public int[] getIndexedFSs()
public void addFS(FeatureStructure fs)
FSIndexRepository
Important: after you have called addFS()
on a FS, do not change the
values of any features used for indexing. If you do, the index will become corrupted and may be
unusable. If you need to change an index feature value, first call
removeFS()
on the FS, change the feature values, then call
addFS()
again.
addFS
in interface FSIndexRepository
fs
- The FS to be added.FSIndexRepository.addFS(org.apache.uima.cas.FeatureStructure)
public void removeFS(FeatureStructure fs)
FSIndexRepository
removeFS
in interface FSIndexRepository
fs
- The FS to be removed.FSIndexRepository.removeFS(org.apache.uima.cas.FeatureStructure)
public void removeFS(int fsRef)
public LinearTypeOrderBuilder createTypeSortOrder()
FSIndexRepositoryMgr
createTypeSortOrder
in interface FSIndexRepositoryMgr
public LowLevelIndex ll_getIndex(String indexName)
LowLevelIndexRepository
ll_getIndex
in interface LowLevelIndexRepository
indexName
- The name of the index.null
if no such index exists.public LowLevelIndex ll_getIndex(String indexName, int typeCode)
LowLevelIndexRepository
ll_getIndex
in interface LowLevelIndexRepository
indexName
- The name of the index.typeCode
- The code of the desired subtype.null
if no such index exists.public final void ll_addFS(int fsRef, boolean doChecks)
LowLevelIndexRepository
ll_addFS
in interface LowLevelIndexRepository
fsRef
- The FS reference to be added to the repository. If fsRef
is not a valid
FS reference, the subsequent behavior of the system is undefined.doChecks
- Check if the FS reference argument is a valid reference.public void ll_addFS(int fsRef)
LowLevelIndexRepository
ll_addFS
in interface LowLevelIndexRepository
fsRef
- The FS reference to be added to the repository. If fsRef
is not a valid
FS reference, the subsequent behavior of the system is undefined.public void ll_addback(int fsRef, int count)
public void ll_removeFS(int fsRef)
LowLevelIndexRepository
ll_removeFS
in interface LowLevelIndexRepository
fsRef
- The FS reference to be removed from the indexes.public LowLevelIterator ll_getAllIndexedFS(Type type)
public <T extends FeatureStructure> FSIterator<T> getAllIndexedFS(Type type)
FSIndexRepository
getAllIndexedFS
in interface FSIndexRepository
T
- The Java class associated with aTypetype
- The typeaType
and its subtypes, in no particular order.public boolean isInSetOrSortedIndexInThisView(int fsAddr)
fsAddr
- the FS to see if it is in some index that could be corrupted by a key feature value changepublic int[] getUpdatedFSs(org.apache.uima.internal.util.PositiveIntSet items)
public int[] getAddedFSs()
public int[] getDeletedFSs()
public int[] getReindexedFSs()
public boolean isModified()
Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.