Class SelectFSs_impl.SelectFSIterator
- All Implemented Interfaces:
Iterator<T>,ListIterator<T>,FSIterator<T>,LowLevelIterator<T>
- Enclosing class:
SelectFSs_impl<T extends FeatureStructure>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LowLevelIterator<T> private Supplier<LowLevelIterator<T>> Fields inherited from interface org.apache.uima.cas.impl.LowLevelIterator
FS_ITERATOR_LOW_LEVEL_EMPTY, IS_ORDERED -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateSelectFSIterator(Supplier<LowLevelIterator<T>> aIteratorSupplier) -
Method Summary
Modifier and TypeMethodDescriptioncopy()Copy this iterator.getNvc()Get the structure the iterator is pointing at.booleanbooleanisValid()Check if this iterator is valid.Get the index for just the top most type of this iterator (excludes subtypes).intintbooleanInternal usevoidmoveTo(FeatureStructure aFs) Move the iterator to the first Feature Structure that matches thefs.voidMove the iterator to the first element.voidInternal use same as moveToFirst, but won't reset to use current contents of index if index has changedvoidMove the iterator to the last element.voidInternal use same as moveToLast, but won't reset to use current contents of index if index has changedvoidversion of moveToNext which bypasses the isValid check - call only if you've just done this check yourselfvoidInternal use same as moveTo(fs), but won't reset to use current contents of index if index has changedvoidversion of moveToPrevious which bypasses the isValid check - call only if you've just done this check yourselfMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.uima.cas.FSIterator
add, get, getType, hasNext, hasPrevious, moveToNext, moveToPrevious, next, nextIndex, nextNvc, previous, previousIndex, previousNvc, remove, set, size, spliterator, streamMethods inherited from interface java.util.Iterator
forEachRemainingMethods inherited from interface org.apache.uima.cas.impl.LowLevelIterator
getArrayList, isMoveToSupported, ll_get, ll_remove, moveTo
-
Field Details
-
iteratorSupplier
-
it
-
-
Constructor Details
-
SelectFSIterator
-
-
Method Details
-
isValid
public boolean isValid()Description copied from interface:FSIteratorCheck if this iterator is valid.- Specified by:
isValidin interfaceFSIterator<T extends FeatureStructure>- Returns:
trueif the iterator is valid.
-
getNvc
Description copied from interface:FSIteratorGet the structure the iterator is pointing at. Throws various unchecked exceptions, if the iterator is not valid- Specified by:
getNvcin interfaceFSIterator<T extends FeatureStructure>- Returns:
- The structure the iterator is pointing at.
-
moveToNextNvc
public void moveToNextNvc()Description copied from interface:FSIteratorversion of moveToNext which bypasses the isValid check - call only if you've just done this check yourself- Specified by:
moveToNextNvcin interfaceFSIterator<T extends FeatureStructure>
-
moveToPreviousNvc
public void moveToPreviousNvc()Description copied from interface:FSIteratorversion of moveToPrevious which bypasses the isValid check - call only if you've just done this check yourself- Specified by:
moveToPreviousNvcin interfaceFSIterator<T extends FeatureStructure>
-
moveToFirst
public void moveToFirst()Description copied from interface:FSIteratorMove the iterator to the first element. The iterator will be valid iff the underlying collection is non-empty. Allowed even if the underlying indexes being iterated over were modified.- Specified by:
moveToFirstin interfaceFSIterator<T extends FeatureStructure>- Specified by:
moveToFirstin interfaceLowLevelIterator<T extends FeatureStructure>
-
moveToLast
public void moveToLast()Description copied from interface:FSIteratorMove the iterator to the last element. The iterator will be valid iff the underlying collection is non-empty. Allowed even if the underlying indexes being iterated over were modified.- Specified by:
moveToLastin interfaceFSIterator<T extends FeatureStructure>- Specified by:
moveToLastin interfaceLowLevelIterator<T extends FeatureStructure>
-
moveTo
Description copied from interface:FSIteratorMove the iterator to the first Feature Structure that matches thefs. First means the earliest one occurring in the index, in case multiple FSs matching the fs are in the index. If no such feature structure exists in the underlying collection, and the iterator is over a sorted index, set the iterator to the "insertion point" forfs, i.e., to a point where the current feature structure compares greater thanfs, and the previous one compares less thanfs, using this sorted index's comparator.If the fs is greater than all of the entries in the index, the moveTo cannot set the iterator to an insertion point where the current feature structure is greater than fs, so it marks the iterator "invalid".
If the underlying index is a set or bag index, or an unordered form of iteration is configured (for example using the
selectAPI, no ordering is present, and the moveTo operation moves to a matching item, if one exists. The match is done using the index's comparator. If none exist, the index is left if possible in some valid (but non-matching) position.When the iterator is over a sorted index whose keys include the typeOrder key, this can cause unexpected operation, depending on type priorities. For example, consider the Annotation Index, which includes this key. If there are many indexed instances of the type "Foo" with the same begin and end, and a moveTo operation is specified using an Annotation instance with the same begin and end, then the Foo elements might or might not be seen going forwards, depending on the relative type priorities of "Foo" and "Annotation".
If you are not making use of typeOrdering, the "select" APIs can create iterators which will ignore the typeOrdering key when doing the moveTo operation, which will result in all the instances of type "Foo" being seen going forwards, independent of the type priorities. See the select documentation in the version 3 users guide.
- Specified by:
moveToin interfaceFSIterator<T extends FeatureStructure>- Specified by:
moveToin interfaceLowLevelIterator<T extends FeatureStructure>- Parameters:
aFs- The feature structure the iterator that supplies the comparison information. It doesn't need to be in the index; it is just being used as a comparison template. It can be a supertype of T as long as it can supply the keys needed. A typical example is a subtype of Annotation, and using an annotation instance to specify the begin / end.
-
copy
Description copied from interface:FSIteratorCopy this iterator.- Specified by:
copyin interfaceFSIterator<T extends FeatureStructure>- Returns:
- A copy of this iterator, pointing at the same element.
-
ll_indexSizeMaybeNotCurrent
public int ll_indexSizeMaybeNotCurrent()- Specified by:
ll_indexSizeMaybeNotCurrentin interfaceLowLevelIterator<T extends FeatureStructure>- Returns:
- The size of the index. In case of copy-on-write, this returns the size of the index at the time the iterator was created, or at the last moveTo, moveToFirst, or moveToLast. To get the current index size, use ll_getIndex().getSize()
-
ll_getIndex
Description copied from interface:LowLevelIteratorGet the index for just the top most type of this iterator (excludes subtypes).- Specified by:
ll_getIndexin interfaceLowLevelIterator<T extends FeatureStructure>- Returns:
- The index.
-
ll_maxAnnotSpan
public int ll_maxAnnotSpan()- Specified by:
ll_maxAnnotSpanin interfaceLowLevelIterator<T extends FeatureStructure>- Returns:
- an estimate of the maximum span over all annotations (end - begin)
-
isIndexesHaveBeenUpdated
public boolean isIndexesHaveBeenUpdated()- Specified by:
isIndexesHaveBeenUpdatedin interfaceLowLevelIterator<T extends FeatureStructure>- Returns:
- true if one or more of the underlying indexes this iterator goes over, has been updated since initialization or resetting operation (moveToFirst/Last/feature_structure). This includes empty iterators becoming non-empty.
-
maybeReinitIterator
public boolean maybeReinitIterator()Description copied from interface:LowLevelIteratorInternal use- Specified by:
maybeReinitIteratorin interfaceLowLevelIterator<T extends FeatureStructure>- Returns:
- true if the iterator was refreshed to match the current index
-
moveToFirstNoReinit
public void moveToFirstNoReinit()Description copied from interface:LowLevelIteratorInternal use same as moveToFirst, but won't reset to use current contents of index if index has changed- Specified by:
moveToFirstNoReinitin interfaceLowLevelIterator<T extends FeatureStructure>
-
moveToLastNoReinit
public void moveToLastNoReinit()Description copied from interface:LowLevelIteratorInternal use same as moveToLast, but won't reset to use current contents of index if index has changed- Specified by:
moveToLastNoReinitin interfaceLowLevelIterator<T extends FeatureStructure>
-
moveToNoReinit
Description copied from interface:LowLevelIteratorInternal use same as moveTo(fs), but won't reset to use current contents of index if index has changed- Specified by:
moveToNoReinitin interfaceLowLevelIterator<T extends FeatureStructure>- Parameters:
aFs- the fs to use as the template identifying the place to move to
-
getComparator
- Specified by:
getComparatorin interfaceLowLevelIterator<T extends FeatureStructure>- Returns:
- the comparator used by this iterator. It is always a withoutID style, and may be either a withType or NoType style.
-