Package org.apache.uima.cas.impl
Class FsIterator_set_sorted2<T extends FeatureStructure>
java.lang.Object
org.apache.uima.cas.impl.FsIterator_singletype<T>
org.apache.uima.cas.impl.FsIterator_set_sorted2<T>
- Type Parameters:
T
- the type of FSs being returned from the iterator, supplied by the calling context
- All Implemented Interfaces:
Iterator<T>
,ListIterator<T>
,FSIterator<T>
,LowLevelIterator<T>
- Direct Known Subclasses:
FsIterator_set_sorted_pear
An iterator for a single type for a set or sorted index
NOTE: This is the version used for set/sorted iterators It is built directly on top of a
CopyOnWrite wrapper for OrderedFsSet_array It uses the version of OrdereFsSet_array that has no
embedded nulls
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Comparator
<TOP> if the iterator is configured to ignore TypeOrdering, then the comparator omits the type (if the index has a type order key)protected final FsIndex_set_sorted
<T> protected CopyOnWriteOrderedFsSet_array
protected int
Fields inherited from class org.apache.uima.cas.impl.FsIterator_singletype
ti
Fields inherited from interface org.apache.uima.cas.impl.LowLevelIterator
FS_ITERATOR_LOW_LEVEL_EMPTY, IS_ORDERED
-
Constructor Summary
ConstructorsConstructorDescriptionFsIterator_set_sorted2
(FsIndex_set_sorted<T> ll_index, CopyOnWriteIndexPart cow_wrapper, Comparator<TOP> comparatorMaybeNoTypeWithoutID) -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Copy this iterator.protected void
getNvc()
Get the structure the iterator is pointing at.boolean
boolean
boolean
isValid()
Check if this iterator is valid.Get the index for just the top most type of this iterator (excludes subtypes).int
int
boolean
Internal usevoid
Internal use same as moveToFirst, but won't reset to use current contents of index if index has changedvoid
Internal use same as moveToLast, but won't reset to use current contents of index if index has changedprivate void
Starting at a position where the item is equal to fs using the compare without id, move to the leftmost one search opportunistically, starting at 1 before, 2, 4, 8, 16, etc.private void
moveToLeftMostUp
(FeatureStructure fs, int upperValidPos) Must be possible to leave the pos == to upperValidPos.void
version of moveToNext which bypasses the isValid check - call only if you've just done this check yourselfvoid
Internal use same as moveTo(fs), but won't reset to use current contents of index if index has changedvoid
version of moveToPrevious which bypasses the isValid check - call only if you've just done this check yourselfint
size()
return the size of the collection being iterated over, if available.Methods inherited from class org.apache.uima.cas.impl.FsIterator_singletype
maybeTraceCowUsingCopy, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.apache.uima.cas.FSIterator
add, get, getType, hasNext, hasPrevious, moveToNext, moveToPrevious, next, nextIndex, nextNvc, previous, previousIndex, previousNvc, remove, set, spliterator, stream
Methods inherited from interface java.util.Iterator
forEachRemaining
Methods inherited from interface org.apache.uima.cas.impl.LowLevelIterator
getArrayList, ll_get, ll_remove, moveTo, moveTo, moveToFirst, moveToLast
-
Field Details
-
ofsa
-
pos
protected int pos -
ll_index
-
comparatorMaybeNoTypeWithoutID
if the iterator is configured to ignore TypeOrdering, then the comparator omits the type (if the index has a type order key)
-
-
Constructor Details
-
FsIterator_set_sorted2
public FsIterator_set_sorted2(FsIndex_set_sorted<T> ll_index, CopyOnWriteIndexPart cow_wrapper, Comparator<TOP> comparatorMaybeNoTypeWithoutID)
-
-
Method Details
-
maybeReinitIterator
public boolean maybeReinitIterator()Description copied from interface:LowLevelIterator
Internal use- Returns:
- true if the iterator was refreshed to match the current index
-
isValid
public boolean isValid()Description copied from interface:FSIterator
Check if this iterator is valid.- Returns:
true
if the iterator is valid.
-
getNvc
Description copied from interface:FSIterator
Get the structure the iterator is pointing at. Throws various unchecked exceptions, if the iterator is not valid- Returns:
- The structure the iterator is pointing at.
-
moveToNextNvc
public void moveToNextNvc()Description copied from interface:FSIterator
version of moveToNext which bypasses the isValid check - call only if you've just done this check yourself -
moveToPreviousNvc
public void moveToPreviousNvc()Description copied from interface:FSIterator
version of moveToPrevious which bypasses the isValid check - call only if you've just done this check yourself -
moveToFirstNoReinit
public void moveToFirstNoReinit()Description copied from interface:LowLevelIterator
Internal use same as moveToFirst, but won't reset to use current contents of index if index has changed -
moveToLastNoReinit
public void moveToLastNoReinit()Description copied from interface:LowLevelIterator
Internal use same as moveToLast, but won't reset to use current contents of index if index has changed -
moveToNoReinit
Description copied from interface:LowLevelIterator
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
-
copy
Description copied from interface:FSIterator
Copy this iterator.- Specified by:
copy
in interfaceFSIterator<T extends FeatureStructure>
- Specified by:
copy
in classFsIterator_singletype<T extends FeatureStructure>
- Returns:
- A copy of this iterator, pointing at the same element.
-
copyCommonSetup
-
ll_indexSizeMaybeNotCurrent
public 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
Description copied from interface:LowLevelIterator
Get the index for just the top most type of this iterator (excludes subtypes).- Returns:
- The index.
-
ll_maxAnnotSpan
public int ll_maxAnnotSpan()- Returns:
- an estimate of the maximum span over all annotations (end - begin)
-
isIndexesHaveBeenUpdated
public 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.
-
moveToLeftMost
Starting at a position where the item is equal to fs using the compare without id, move to the leftmost one search opportunistically, starting at 1 before, 2, 4, 8, 16, etc. then doing binary search in the opposite dir These methods are in this class because they manipulate "pos"- Parameters:
fs
- -
-
moveToLeftMostUp
Must be possible to leave the pos == to upperValidPos. Starts searching from next above current pos- Parameters:
fs
-upperValidPos
-
-
getComparator
- Returns:
- the comparator used by this iterator. It is always a withoutID style, and may be either a withType or NoType style.
-
isMoveToSupported
public boolean isMoveToSupported()- Returns:
- false if this iterator is over an unordered collection or set or bag
-
size
public int size()Description copied from interface:FSIterator
return the size of the collection being iterated over, if available. Because the iterator can move forwards and backwards, the size is the total size that the iterator would iterate over, starting at the first element thru the last element. This may be inefficient to compute.- Returns:
- the size of the collection being iterated over.
-