Package org.apache.uima.cas
Interface FSIndexRepository
-
- All Known Subinterfaces:
FSIndexRepositoryMgr
- All Known Implementing Classes:
FSIndexRepositoryImpl
public interface FSIndexRepository
Repository of indexes over feature structures. Use this interface to access previously defined indexes. Generics: T is the associated Java cover class for the top type defined for this index name. If JCas is being used, it is that JCas class. Otherwise it is the standard non-JCas Java cover class.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <T extends FeatureStructure>
voidaddFS(T fs)
Add a feature structure to all appropriate indexes in the repository.default <T extends FeatureStructure>
FSIterator<T>getAllIndexedFS(java.lang.Class<T> clazz)
Gets an FSIterator over all indexed (in this view) FeatureStructures of the specified Type (and any of its subtypes).<T extends FeatureStructure>
FSIterator<T>getAllIndexedFS(Type aType)
Gets an iterator over all indexed (in this View) FeatureStructures of the specified Type (and any of its subtypes).<T extends FeatureStructure>
FSIndex<T>getIndex(java.lang.String label)
Retrieve an index according to a label.<T extends FeatureStructure>
FSIndex<T>getIndex(java.lang.String label, Type type)
Retrieve an index according to a label and a type.<T extends TOP>
java.util.Collection<T>getIndexedFSs()
Returns an unmodifiable collection of all of the FSs that are indexed in this view, in an arbitrary order.<T extends TOP>
java.util.Collection<T>getIndexedFSs(java.lang.Class<T> clazz)
Returns an unmodifiable collection of all the FSs of this type and its subtypes, that are indexed in this view, in an arbitrary order.<T extends TOP>
java.util.Collection<T>getIndexedFSs(Type type)
Returns an unmodifiable collection of all the FSs of this type and its subtypes, that are indexed in this view, in an arbitrary order.<T extends FeatureStructure>
java.util.Iterator<FSIndex<T>>getIndexes()
Get all indexes in this repository.java.util.Iterator<java.lang.String>
getLabels()
Get all labels for all indexes.<T extends FeatureStructure>
java.util.Iterator<LowLevelIndex<T>>ll_getIndexes()
Get all indexes in this repository as low level indexesdefault <T extends TOP>
voidremoveAllExcludingSubtypes(java.lang.Class<T> clazz)
Remove all instances of just this type, excluding subtypes, from all indexes in the repository view.void
removeAllExcludingSubtypes(Type type)
Remove all instances of just this type, excluding subtypes, from all indexes in the repository view.default <T extends TOP>
voidremoveAllIncludingSubtypes(java.lang.Class<T> clazz)
Remove all instances of type, including all subtypes from all indexes in the repository view.void
removeAllIncludingSubtypes(Type type)
Remove all instances of type, including all subtypes from all indexes in the repository view.<T extends FeatureStructure>
voidremoveFS(T fs)
Remove a feature structure from all indexes in the repository.
-
-
-
Method Detail
-
getIndex
<T extends FeatureStructure> FSIndex<T> getIndex(java.lang.String label)
Retrieve an index according to a label. Generics: T is the associated Java cover class for the top type defined for this index name.- Type Parameters:
T
- the Java class associated with the top-most type of the index- Parameters:
label
- The name of the index.- Returns:
- The index with the name
label
, ornull
if no such index is defined.
-
getIndex
<T extends FeatureStructure> FSIndex<T> getIndex(java.lang.String label, Type type) throws CASRuntimeException
Retrieve an index according to a label and a type. The type is used to narrow down the index of a more general type to a more specific one. Generics: T is the associated Java cover class for the type.- Type Parameters:
T
- The Java class associated with the type- Parameters:
label
- The name of the index.type
- A subtype of the type of the index.- Returns:
- The specified, or
null
if an index with that name doesn't exist. - Throws:
CASRuntimeException
- Whentype
is not a subtype of the index's type.
-
getLabels
java.util.Iterator<java.lang.String> getLabels()
Get all labels for all indexes.- Returns:
- All labels.
-
getIndexes
<T extends FeatureStructure> java.util.Iterator<FSIndex<T>> getIndexes()
Get all indexes in this repository.- Type Parameters:
T
- the generic type of the FeatureStructures- Returns:
- All indexes.
-
ll_getIndexes
<T extends FeatureStructure> java.util.Iterator<LowLevelIndex<T>> ll_getIndexes()
Get all indexes in this repository as low level indexes- Type Parameters:
T
- the generic type of the FeatureStructures- Returns:
- All indexes.
-
addFS
<T extends FeatureStructure> void addFS(T fs)
Add a feature structure to all appropriate indexes in the repository. If no indexes exist for the type of FS that you are adding, then a bag (unsorted) index will be automatically created.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 callremoveFS()
on the FS, change the feature values, then calladdFS()
again.- Type Parameters:
T
- the generic type of the FeatureStructure- Parameters:
fs
- The FS to be added.- Throws:
java.lang.NullPointerException
- If thefs
parameter isnull
.
-
removeFS
<T extends FeatureStructure> void removeFS(T fs)
Remove a feature structure from all indexes in the repository.- Type Parameters:
T
- the generic type of the FeatureStructure- Parameters:
fs
- The FS to be removed. The fs must be the exact FS to remove, not just one which compares "equal" using the index's comparator.- Throws:
java.lang.NullPointerException
- If thefs
parameter isnull
.
-
removeAllIncludingSubtypes
void removeAllIncludingSubtypes(Type type)
Remove all instances of type, including all subtypes from all indexes in the repository view.- Parameters:
type
- the type to remove- Throws:
java.lang.NullPointerException
- if thetype
parameter isnull
.
-
removeAllIncludingSubtypes
default <T extends TOP> void removeAllIncludingSubtypes(java.lang.Class<T> clazz)
Remove all instances of type, including all subtypes from all indexes in the repository view.- Type Parameters:
T
- the type to remove- Parameters:
clazz
- the JCas class of the type to remove. To remove all use TOP.class- Throws:
java.lang.NullPointerException
- if theclazz
parameter isnull
.
-
removeAllExcludingSubtypes
void removeAllExcludingSubtypes(Type type)
Remove all instances of just this type, excluding subtypes, from all indexes in the repository view.- Parameters:
type
- the type to remove- Throws:
java.lang.NullPointerException
- if thetype
parameter isnull
.
-
removeAllExcludingSubtypes
default <T extends TOP> void removeAllExcludingSubtypes(java.lang.Class<T> clazz)
Remove all instances of just this type, excluding subtypes, from all indexes in the repository view.- Type Parameters:
T
- the type to remove- Parameters:
clazz
- the JCas Class of the type to remove- Throws:
java.lang.NullPointerException
- if thetype
parameter isnull
.
-
getAllIndexedFS
<T extends FeatureStructure> FSIterator<T> getAllIndexedFS(Type aType)
Gets an iterator over all indexed (in this View) FeatureStructures of the specified Type (and any of its subtypes). The elements are returned in arbitrary order. Generics: T is the Java class for aType.- Type Parameters:
T
- The Java class associated with aType- Parameters:
aType
- The type- Returns:
- An iterator that returns all indexed FeatureStructures of type
aType
and its subtypes, in no particular order.
-
getAllIndexedFS
default <T extends FeatureStructure> FSIterator<T> getAllIndexedFS(java.lang.Class<T> clazz)
Gets an FSIterator over all indexed (in this view) FeatureStructures of the specified Type (and any of its subtypes). The elements are returned in arbitrary order. Generics: T is the Java class for aType.- Type Parameters:
T
- The Java class associated with aType- Parameters:
clazz
- The JCas class corresponding to the type- Returns:
- An iterator that returns all indexed FeatureStructures of the specified type and its subtypes, in no particular order.
-
getIndexedFSs
<T extends TOP> java.util.Collection<T> getIndexedFSs(Type type)
Returns an unmodifiable collection of all the FSs of this type and its subtypes, that are indexed in this view, in an arbitrary order. Subsequent modifications to the indexes do not affect this collection.- Type Parameters:
T
- The Java class associated with type- Parameters:
type
- the type of Feature Structures to include (including subtypes)- Returns:
- an unmodifiable, unordered collection of all indexed (in this view) Feature Structures of the specified type (including subtypes)
-
getIndexedFSs
<T extends TOP> java.util.Collection<T> getIndexedFSs(java.lang.Class<T> clazz)
Returns an unmodifiable collection of all the FSs of this type and its subtypes, that are indexed in this view, in an arbitrary order. Subsequent modifications to the indexes do not affect this collection.- Type Parameters:
T
- The Java class associated with type- Parameters:
clazz
- The JCas class corresponding to the type- Returns:
- an unmodifiable, unordered collection of all indexed (in this view) Feature Structures of the specified type (including subtypes)
-
getIndexedFSs
<T extends TOP> java.util.Collection<T> getIndexedFSs()
Returns an unmodifiable collection of all of the FSs that are indexed in this view, in an arbitrary order. Subsequent modifications to the indexes do not affect this collection.- Type Parameters:
T
- The Java class associated with type- Returns:
- an unmodifiable, unordered collection of all indexed (in this view) Feature Structures of the specified type (including subtypes)
-
-