Package org.apache.uima.cas.impl
Class FSIndexRepositoryImpl.IndexImpl<T extends FeatureStructure>
java.lang.Object
org.apache.uima.cas.impl.FSIndexRepositoryImpl.IndexImpl<T>
- Type Parameters:
T
- - the particular type (and it subtypes) this particular index is associated with
- All Implemented Interfaces:
Iterable<T>
,FSIndex<T>
,FSIndexImpl
,LowLevelIndex
- Enclosing class:
- FSIndexRepositoryImpl
class FSIndexRepositoryImpl.IndexImpl<T extends FeatureStructure>
extends Object
implements FSIndex<T>, FSIndexImpl
Implementation of a particular index for a particular Type (and its subtypes)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FSIndexRepositoryImpl.IndexIteratorCachePair<T>
private final boolean
private final boolean
Fields inherited from interface org.apache.uima.cas.FSIndex
BAG_INDEX, DEFAULT_BAG_INDEX, SET_INDEX, SORTED_INDEX
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
private
IndexImpl
(FSIndexRepositoryImpl.IndexIteratorCachePair<T> iicp, FSIndexRepositoryImpl.IteratorExtraFunction extraFn) -
Method Summary
Modifier and TypeMethodDescriptionint
compare
(FeatureStructure fs1, FeatureStructure fs2) Compare two feature structures according to the ordering relation of the index.boolean
Check if the index contains an element equal to the given feature structure according to the comparators defined for this index.find
(FeatureStructure fs) Find an entry in the index "equal to" the given feature structure according to the comparators specified for this index.void
flush()
(package private) FSIndexRepositoryImpl
int
Return the indexing strategy.getType()
Return the type of feature structures this index contains.iterator()
Return an iterator over the index.Return an iterator over the index.int
ll_compare
(int ref1, int ref2) Get a low-level, FS reference iterator.ll_iterator
(boolean ambiguous) Get a low-level, FS reference iterator.Get a low-level, FS reference iterator specifying instances of the precise type only (i.e.private FSIterator<T>
nonFlatIterator
(FeatureStructure fs, boolean respectUnordered) int
size()
Return the number of feature structures in this index.Creates a shared copy of this FSIndex configured to produce snapshot iterators that don't throw ConcurrentModificationExceptions.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
iicp
-
is_with_snapshot_iterators
private final boolean is_with_snapshot_iterators -
is_unordered
private final boolean is_unordered
-
-
Constructor Details
-
IndexImpl
-
IndexImpl
private IndexImpl(FSIndexRepositoryImpl.IndexIteratorCachePair<T> iicp, FSIndexRepositoryImpl.IteratorExtraFunction extraFn)
-
-
Method Details
-
ll_compare
public int ll_compare(int ref1, int ref2) - Specified by:
ll_compare
in interfaceLowLevelIndex
-
getIndexingStrategy
public int getIndexingStrategy()Description copied from interface:FSIndex
Return the indexing strategy.- Specified by:
getIndexingStrategy
in interfaceFSIndex<T extends FeatureStructure>
- Returns:
- One of
SORTED_INDEX
,BAG_INDEX
orSET_INDEX
. - See Also:
-
getComparator
- Specified by:
getComparator
in interfaceFSIndexImpl
- Returns:
- the FSIndexComparator structure used by this index
- See Also:
-
org.apache.uima.cas.FSIndexImpl#getComparator()
-
flush
public void flush()- Specified by:
flush
in interfaceFSIndexImpl
-
compare
Description copied from interface:FSIndex
Compare two feature structures according to the ordering relation of the index. If the input feature structures are not of the type of the index, the result is undefined.- Specified by:
compare
in interfaceFSIndex<T extends FeatureStructure>
- Parameters:
fs1
- the first Feature Structure to comparefs2
- the second Feature Structure to compare- Returns:
-1
iffs1 < fs2
;0
iffs1 = fs2
;1
else.- See Also:
-
contains
Description copied from interface:FSIndex
Check if the index contains an element equal to the given feature structure according to the comparators defined for this index. For bag indexes (which have no comparators), the equality test means the identical feature structure. Note that this is in general not the same as feature structure identity.- Specified by:
contains
in interfaceFSIndex<T extends FeatureStructure>
- Parameters:
fs
- A Feature Structure used a template to match for equality with the FSs in the index.- Returns:
true
if the index contains such an element.- See Also:
-
find
Description copied from interface:FSIndex
Find an entry in the index "equal to" the given feature structure according to the comparators specified for this index. Note that this is in general not the same as feature structure identity. For BAG indexes, it is identity, for others it means the found feature structure compares equal with the parameter in terms of the defined comparators for the index.- Specified by:
find
in interfaceFSIndex<T extends FeatureStructure>
- Parameters:
fs
- A Feature Structure used a template to match with the Feature Structures in the index.- Returns:
- A FS equal to the template argument, or
null
if no such FS exists. - See Also:
-
getType
Description copied from interface:FSIndex
Return the type of feature structures this index contains.- Specified by:
getType
in interfaceFSIndex<T extends FeatureStructure>
- Returns:
- The type of feature structures in this index.
- See Also:
-
iterator
Description copied from interface:FSIndex
Return an iterator over the index. The iterator will be set to the start position of the index.- Specified by:
iterator
in interfaceFSIndex<T extends FeatureStructure>
- Specified by:
iterator
in interfaceIterable<T extends FeatureStructure>
- Returns:
- An iterator over the index.
- See Also:
-
iterator
Description copied from interface:FSIndex
Return an iterator over the index. The position of the iterator will be set such that the feature structure returned by a call to the iterator'sget()
method is greater than or equal tofs
, and any previous FS is less thanFS
(the iterator is positioned at the earliest of equal values). If no such position exists, the iterator will be invalid.- Specified by:
iterator
in interfaceFSIndex<T extends FeatureStructure>
- Parameters:
fs
- The feature structure at which the iterator should be positioned.- Returns:
- An iterator positioned at
fs
, if it exists. An invalid iterator, else. - See Also:
-
nonFlatIterator
-
getIntIterator
- Specified by:
getIntIterator
in interfaceFSIndexImpl
-
size
public int size()Description copied from interface:FSIndex
Return the number of feature structures in this index.- Specified by:
size
in interfaceFSIndex<T extends FeatureStructure>
- Specified by:
size
in interfaceLowLevelIndex
- Returns:
- The number of FSs in this index.
- See Also:
-
ll_iterator
Description copied from interface:LowLevelIndex
Get a low-level, FS reference iterator.- Specified by:
ll_iterator
in interfaceLowLevelIndex
- Returns:
- An iterator for this index.
-
ll_rootIterator
Description copied from interface:LowLevelIndex
Get a low-level, FS reference iterator specifying instances of the precise type only (i.e. without listing the subtypes).- Specified by:
ll_rootIterator
in interfaceLowLevelIndex
- Returns:
- An iterator for the root type of this index.
-
ll_iterator
Description copied from interface:LowLevelIndex
Get a low-level, FS reference iterator. This iterator can be disambiguated. This means that only non-overlapping annotations will be returned. Non-annotation FSs will be filtered in this mode.- Specified by:
ll_iterator
in interfaceLowLevelIndex
- Parameters:
ambiguous
- When set tofalse
, iterator will be disambiguated.- Returns:
- An iterator for this index.
-
withSnapshotIterators
Description copied from interface:FSIndex
Creates a shared copy of this FSIndex configured to produce snapshot iterators that don't throw ConcurrentModificationExceptions.- Specified by:
withSnapshotIterators
in interfaceFSIndex<T extends FeatureStructure>
- Returns:
- a light-weight copy of this FSIndex, configured such that any iterator created using it will be a snapshot iterator - one where a snapshot is made of the state of the index at the time the iterator is created, and where subsequent modifications to the underlying index are allowed, but don't affect the iterator (which iterates over the read-only snapshot). Iterators produced with this won't throw ConcurrentModificationExceptions.
- See Also:
-
getFsRepositoryImpl
FSIndexRepositoryImpl getFsRepositoryImpl()
-