Package org.apache.uima.cas.impl
Class FsIndex_bag<T extends FeatureStructure>
java.lang.Object
java.util.AbstractCollection<T>
org.apache.uima.cas.impl.FsIndex_singletype<T>
org.apache.uima.cas.impl.FsIndex_bag<T>
- Type Parameters:
T- the Java cover class type for this index, passed along to (wrapped) iterators producing Java cover classes NOTE: V3 doesn't support ALLOW_DUP_ADD_TO_INDEXES
- All Implemented Interfaces:
Iterable<T>,Collection<T>,Comparator<FeatureStructure>,FSIndex<T>,LowLevelIndex<T>
Used for UIMA FS Bag Indexes Uses ObjHashSet to hold instances of FeatureStructures
-
Field Summary
Fields inherited from class org.apache.uima.cas.impl.FsIndex_singletype
casImpl, comparatorForIndexSpecs, comparatorNoTypeWithID, comparatorNoTypeWithoutID, comparatorWithID, comparatorWithoutID, isAnnotIdx, type, wr_cowFields inherited from interface org.apache.uima.cas.FSIndex
BAG_INDEX, DEFAULT_BAG_INDEX, SET_INDEX, SORTED_INDEXFields inherited from interface org.apache.uima.cas.impl.LowLevelIndex
FS_ID_COMPARATOR, IS_ORDERED, IS_TYPE_ORDER -
Method Summary
Modifier and TypeMethodDescriptionprotected voidFor serialization: get all the items in this index and bulk add to an List<T>intcompare(FeatureStructure fs1, FeatureStructure fs2) Override the super impl which uses comparators.booleanCheck if the index contains an element equal to the given feature structure according to the comparators defined for this index.protected CopyOnWriteIndexPart<T>booleanonly for backwards compatibilityfind(FeatureStructure fs) This is a silly method for bag indexes in V3, since dupl add to indexes is not allowed.voidflush()inthashCode()final voiditerator()Return an iterator over the index.iterator(boolean orderNotNeeded, boolean ignoreType) Internal use, used by select framework.intintsize()Return the number of feature structures in this index.Methods inherited from class org.apache.uima.cas.impl.FsIndex_singletype
assertFsTypeMatchesIndexType, compare, equals, getCasImpl, getComparator, getComparatorForIndexSpecs, getComparatorImplForIndexSpecs, getCopyOnWriteIndexPart, getIndexingStrategy, getNonNullCow, getType, getTypeImpl, isSorted, iterator, ll_compare, ll_iterator, maybeCopy, toString, withSnapshotIteratorsMethods inherited from class java.util.AbstractCollection
add, addAll, clear, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArrayMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
add, addAll, clear, contains, containsAll, isEmpty, parallelStream, remove, removeAll, removeIf, retainAll, spliterator, toArray, toArray, toArrayMethods inherited from interface java.util.Comparator
reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLongMethods inherited from interface org.apache.uima.cas.impl.LowLevelIndex
getIntIterator, getSubIndex, getSubIndex, ll_iterator, select, select, select, select, select
-
Method Details
-
flush
public void flush()- Specified by:
flushin interfaceLowLevelIndex<T extends FeatureStructure>- Overrides:
flushin classFsIndex_singletype<T extends FeatureStructure>
-
insert
-
compare
Override the super impl which uses comparators. For bag indexes, compare equal only if identical addresses- Specified by:
comparein interfaceComparator<T extends FeatureStructure>- Specified by:
comparein interfaceFSIndex<T extends FeatureStructure>- Specified by:
comparein classFsIndex_singletype<T extends FeatureStructure>- Parameters:
fs1- the first Feature Structure to comparefs2- the second Feature Structure to compare- Returns:
-1iffs1 < fs2;0iffs1 = fs2;1else.
-
contains
Description copied from interface:FSIndexCheck 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:
trueif the index contains such an element.- See Also:
-
find
This is a silly method for bag indexes in V3, since dupl add to indexes is not allowed.- Parameters:
fs- -- Returns:
- null or the original fs if the fs is in the index
- See Also:
-
size
public int size()Description copied from interface:FSIndexReturn the number of feature structures in this index.- Specified by:
sizein interfaceCollection<T extends FeatureStructure>- Specified by:
sizein interfaceFSIndex<T extends FeatureStructure>- Specified by:
sizein classAbstractCollection<T extends FeatureStructure>- Returns:
- The number of FSs in this index.
- See Also:
-
deleteFS
only for backwards compatibility -
hashCode
public int hashCode()- Specified by:
hashCodein interfaceCollection<T extends FeatureStructure>- Overrides:
hashCodein classFsIndex_singletype<T extends FeatureStructure>
-
bulkAddTo
Description copied from class:FsIndex_singletypeFor serialization: get all the items in this index and bulk add to an List<T>- Specified by:
bulkAddToin classFsIndex_singletype<T extends FeatureStructure>- Parameters:
fss- the set of items to add
-
iterator
Description copied from interface:LowLevelIndexInternal 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.
-
createCopyOnWriteIndexPart
- Specified by:
createCopyOnWriteIndexPartin 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.
-
iterator
Description copied from interface:LowLevelIndexReturn 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:
iteratorin interfaceCollection<T extends FeatureStructure>- Specified by:
iteratorin interfaceFSIndex<T extends FeatureStructure>- Specified by:
iteratorin interfaceIterable<T extends FeatureStructure>- Specified by:
iteratorin interfaceLowLevelIndex<T extends FeatureStructure>- Specified by:
iteratorin classAbstractCollection<T extends FeatureStructure>- Returns:
- An FSIterator positioned at the beginning, or an invalid iterator.
-