Interface LowLevelIterator<T extends FeatureStructure>
- All Superinterfaces:
FSIterator<T>
,Iterator<T>
,ListIterator<T>
- All Known Implementing Classes:
FsIterator_multiple_indexes
,FsIterator_singletype
,FsIterator_subtypes_ordered
,FsIterator_subtypes_snapshot
,FSIteratorImplBase
,LLUnambiguousIteratorImpl
,LowLevelIterator_empty
,Subiterator
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final LowLevelIterator<FeatureStructure>
an empty iteratorstatic final boolean
Internal use constants -
Method Summary
Modifier and TypeMethodDescriptiondefault void
getArrayList
(ArrayList<? super T> arrayList) boolean
default boolean
default int
ll_get()
Return the current FS reference.Get the index for just the top most type of this iterator (excludes subtypes).int
int
default void
boolean
Internal usedefault void
moveTo
(int fsRef) Try to position the iterator so that the current element is greater than or equal tofsRef
, and previous elements are less thanfsRef
.default void
Move the iterator to the first Feature Structure that matches thefs
.default void
Move the iterator to the first element.void
Internal use same as moveToFirst, but won't reset to use current contents of index if index has changeddefault void
Move the iterator to the last element.void
Internal use same as moveToLast, but won't reset to use current contents of index if index has changedvoid
Internal use same as moveTo(fs), but won't reset to use current contents of index if index has changedMethods inherited from interface org.apache.uima.cas.FSIterator
add, copy, get, getNvc, getType, hasNext, hasPrevious, isValid, moveToNext, moveToNextNvc, moveToPrevious, moveToPreviousNvc, next, nextIndex, nextNvc, previous, previousIndex, previousNvc, remove, set, size, spliterator, stream
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
FS_ITERATOR_LOW_LEVEL_EMPTY
an empty iterator -
IS_ORDERED
static final boolean IS_ORDEREDInternal use constants- See Also:
-
-
Method Details
-
ll_get
Return the current FS reference.- Returns:
- The current FS reference.
- Throws:
NoSuchElementException
- Iff the iterator is not valid.
-
moveTo
default void moveTo(int fsRef) Try to position the iterator so that the current element is greater than or equal tofsRef
, and previous elements are less thanfsRef
. This may invalidate the iterator. If fsRef can not be compared to FSs in the index, the results are undefined.- Parameters:
fsRef
- The FS reference the iterator should be set to.
-
ll_indexSizeMaybeNotCurrent
int ll_indexSizeMaybeNotCurrent()- 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
LowLevelIndex<T> ll_getIndex()Get the index for just the top most type of this iterator (excludes subtypes).- Returns:
- The index.
-
ll_maxAnnotSpan
int ll_maxAnnotSpan()- Returns:
- an estimate of the maximum span over all annotations (end - begin)
-
isIndexesHaveBeenUpdated
boolean isIndexesHaveBeenUpdated()- 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
boolean maybeReinitIterator()Internal use- Returns:
- true if the iterator was refreshed to match the current index
-
moveToFirst
default void moveToFirst()Description copied from interface:FSIterator
Move 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:
moveToFirst
in interfaceFSIterator<T extends FeatureStructure>
-
moveToLast
default void moveToLast()Description copied from interface:FSIterator
Move 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:
moveToLast
in interfaceFSIterator<T extends FeatureStructure>
-
moveTo
Description copied from interface:FSIterator
Move 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
select
API, 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:
moveTo
in interfaceFSIterator<T extends FeatureStructure>
- Parameters:
fs
- 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.
-
moveToFirstNoReinit
void moveToFirstNoReinit()Internal use same as moveToFirst, but won't reset to use current contents of index if index has changed -
moveToLastNoReinit
void moveToLastNoReinit()Internal use same as moveToLast, but won't reset to use current contents of index if index has changed -
moveToNoReinit
Internal use same as moveTo(fs), but won't reset to use current contents of index if index has changed- Parameters:
fs
- the fs to use as the template identifying the place to move to
-
getComparator
Comparator<TOP> getComparator()- Returns:
- the comparator used by this iterator. It is always a withoutID style, and may be either a withType or NoType style.
-
ll_remove
default void ll_remove() -
isMoveToSupported
default boolean isMoveToSupported()- Returns:
- false if this iterator is over an unordered collection or set or bag
-
getArrayList
- Parameters:
arrayList
- updated by adding elements representing the collection of items the iterator would return from its current position to the end NOTE: This operation will move the iterator from its current position to the end.
-