Package org.apache.uima.cas.impl
Class FsIterator_bag<T extends FeatureStructure>
- java.lang.Object
-
- org.apache.uima.cas.impl.FsIterator_singletype<T>
-
- org.apache.uima.cas.impl.FsIterator_bag<T>
-
- All Implemented Interfaces:
java.util.Iterator<T>
,java.util.ListIterator<T>
,FSIterator<T>
,LowLevelIterator<T>
- Direct Known Subclasses:
FsIterator_bag_pear
class FsIterator_bag<T extends FeatureStructure> extends FsIterator_singletype<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected CopyOnWriteObjHashSet<T>
bag
protected FsIndex_bag<T>
fsBagIndex
private boolean
isGoingForward
private static java.util.concurrent.atomic.AtomicInteger
moveToCount
private int
position
-
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
Constructors Constructor Description FsIterator_bag(FsIndex_bag<T> fsBagIndex, TypeImpl ti, CopyOnWriteIndexPart<T> cow_wrapper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FsIterator_bag<T>
copy()
Copy this iterator.protected void
copyCommonSetup(FsIterator_bag<T> copy)
java.util.Comparator<TOP>
getComparator()
T
getNvc()
Get the structure the iterator is pointing at.boolean
isIndexesHaveBeenUpdated()
boolean
isValid()
Check if this iterator is valid.LowLevelIndex<T>
ll_getIndex()
Get the index for just the top most type of this iterator (excludes subtypes).int
ll_indexSizeMaybeNotCurrent()
int
ll_maxAnnotSpan()
boolean
maybeReinitIterator()
Internal usevoid
moveToFirstNoReinit()
Internal use same as moveToFirst, but won't reset to use current contents of index if index has changedvoid
moveToLastNoReinit()
Internal use same as moveToLast, but won't reset to use current contents of index if index has changedvoid
moveToNextNvc()
version of moveToNext which bypasses the isValid check - call only if you've just done this check yourselfvoid
moveToNoReinit(FeatureStructure fs)
Internal use same as moveTo(fs), but won't reset to use current contents of index if index has changedvoid
moveToPreviousNvc()
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 org.apache.uima.cas.impl.LowLevelIterator
getArrayList, isMoveToSupported, ll_get, ll_remove, moveTo, moveTo, moveToFirst, moveToLast
-
-
-
-
Field Detail
-
moveToCount
private static final java.util.concurrent.atomic.AtomicInteger moveToCount
-
bag
protected CopyOnWriteObjHashSet<T extends FeatureStructure> bag
-
fsBagIndex
protected final FsIndex_bag<T extends FeatureStructure> fsBagIndex
-
position
private int position
-
isGoingForward
private boolean isGoingForward
-
-
Constructor Detail
-
FsIterator_bag
FsIterator_bag(FsIndex_bag<T> fsBagIndex, TypeImpl ti, CopyOnWriteIndexPart<T> cow_wrapper)
-
-
Method Detail
-
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
public T 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.
-
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
-
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
-
moveToNoReinit
public void moveToNoReinit(FeatureStructure fs)
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
public FsIterator_bag<T> 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
protected void copyCommonSetup(FsIterator_bag<T> copy)
-
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_maxAnnotSpan
public int ll_maxAnnotSpan()
- Returns:
- an estimate of the maximum span over all annotations (end - begin)
-
ll_getIndex
public LowLevelIndex<T> ll_getIndex()
Description copied from interface:LowLevelIterator
Get the index for just the top most type of this iterator (excludes subtypes).- Returns:
- The index.
-
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.
-
getComparator
public java.util.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.
-
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.
-
-