Package org.apache.uima.cas.impl
Class FsIndex_flat<T extends FeatureStructure>
java.lang.Object
java.util.AbstractCollection<T>
org.apache.uima.cas.impl.FsIndex_singletype<T>
org.apache.uima.cas.impl.FsIndex_flat<T>
- Type Parameters:
T
- the Java class type for this index
- All Implemented Interfaces:
Iterable<T>
,Collection<T>
,Comparator<FeatureStructure>
,FSIndex<T>
,LowLevelIndex<T>
Common part of flattened indexes, used for both snapshot iterators and flattened sorted indexes
built from passed in instance of FsIndex_iicp
-
Field Summary
Fields inherited from class org.apache.uima.cas.impl.FsIndex_singletype
casImpl, comparatorForIndexSpecs, comparatorNoTypeWithID, comparatorNoTypeWithoutID, comparatorWithID, comparatorWithoutID, isAnnotIdx, type, wr_cow
Fields inherited from interface org.apache.uima.cas.FSIndex
BAG_INDEX, DEFAULT_BAG_INDEX, SET_INDEX, SORTED_INDEX
Fields inherited from interface org.apache.uima.cas.impl.LowLevelIndex
FS_ID_COMPARATOR, IS_ORDERED, IS_TYPE_ORDER
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
For serialization: get all the items in this index and bulk add to an List<T>protected void
bulkAddTo
(org.apache.uima.internal.util.IntVector v) int
compare
(FeatureStructure fs1, FeatureStructure fs2) This is required to avoid compilation error (but not in Eclipse) due to ambiguous interface inheritance from both FeatureStructure and Comparatorboolean
Check if the index contains an element equal to the given feature structure according to the comparators defined for this index.protected CopyOnWriteIndexPart
boolean
find
(FeatureStructure fs) Find an entry in the index "equal to" the given feature structure according to the comparators specified for this index.iterator()
Return an iterator over the index.iterator
(boolean orderNotNeeded, boolean ignoreType) Internal use, used by select framework.int
int
size()
Return the number of feature structures in this index.Methods inherited from class org.apache.uima.cas.impl.FsIndex_singletype
assertFsTypeMatchesIndexType, compare, equals, flush, getCasImpl, getComparator, getComparatorForIndexSpecs, getComparatorImplForIndexSpecs, getCopyOnWriteIndexPart, getIndexingStrategy, getNonNullCow, getType, getTypeImpl, hashCode, isSorted, iterator, ll_compare, ll_iterator, maybeCopy, toString, withSnapshotIterators
Methods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, toArray, toArray, toArray
Methods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface org.apache.uima.cas.impl.LowLevelIndex
getIntIterator, getSubIndex, getSubIndex, ll_iterator, select, select, select, select, select
-
Method Details
-
iterator
Description copied from interface:LowLevelIndex
Return an iterator over the index. The position of the iterator will be set to return the first item in the index. If the index is empty, the iterator position will be marked as invalid.- Specified by:
iterator
in interfaceCollection<T extends FeatureStructure>
- Specified by:
iterator
in interfaceFSIndex<T extends FeatureStructure>
- Specified by:
iterator
in interfaceIterable<T extends FeatureStructure>
- Specified by:
iterator
in interfaceLowLevelIndex<T extends FeatureStructure>
- Specified by:
iterator
in classAbstractCollection<T extends FeatureStructure>
- Returns:
- An FSIterator positioned at the beginning, or an invalid iterator.
-
iterator
Description copied from interface:LowLevelIndex
Internal use, used by select framework. Return an iterator over the index. The position of the iterator will be set to return the first item in the index. If the index is empty, the iterator position will be marked as invalid.- Parameters:
orderNotNeeded
- if true, skips work while iterating to keep iterators over multiple types in sync.ignoreType
- if true, the comparator used for moveTo leftmost operations will ignore typeOrder keys, if the index happens to define these- Returns:
- An FSIterator positioned at the beginning, or an invalid iterator.
-
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.
The element is used as a template, and may be a supertype of the type of the index, as long as the keys specified for this index can be accessed.
- 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.
-
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. If there are multiple different FSs in the index which compare equal with the given feature structure, an arbitrary one is returned. This differs from the moveTo(fs) operation which guarantees to move to the first feature structure occurring in the index in this case.- Parameters:
fs
- A Feature Structure used a template to match with the Feature Structures in the index. It must have the keys needed to do the compare as specified for the index that it's in.- Returns:
- A FS equal to the template argument, or
null
if no such FS exists. - See Also:
-
size
public int size()Description copied from interface:FSIndex
Return the number of feature structures in this index.- Specified by:
size
in interfaceCollection<T extends FeatureStructure>
- Specified by:
size
in interfaceFSIndex<T extends FeatureStructure>
- Specified by:
size
in classAbstractCollection<T extends FeatureStructure>
- Returns:
- The number of FSs in this index.
- See Also:
-
deleteFS
- See Also:
-
FsIndex_singletype.deleteFS(FeatureStructure)
-
bulkAddTo
Description copied from class:FsIndex_singletype
For serialization: get all the items in this index and bulk add to an List<T>- Specified by:
bulkAddTo
in classFsIndex_singletype<T extends FeatureStructure>
- Parameters:
v
- the set of items to add
-
bulkAddTo
protected void bulkAddTo(org.apache.uima.internal.util.IntVector v) -
compare
Description copied from class:FsIndex_singletype
This is required to avoid compilation error (but not in Eclipse) due to ambiguous interface inheritance from both FeatureStructure and Comparator- Specified by:
compare
in interfaceComparator<T extends FeatureStructure>
- Specified by:
compare
in interfaceFSIndex<T extends FeatureStructure>
- Specified by:
compare
in classFsIndex_singletype<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:
-
createCopyOnWriteIndexPart
- Specified by:
createCopyOnWriteIndexPart
in classFsIndex_singletype<T extends FeatureStructure>
-
ll_maxAnnotSpan
public int ll_maxAnnotSpan()- Returns:
- for annotation indexes, an conservative estimate the maximum span between begin and end The value may be larger than actual.
-