Package org.apache.uima.cas.impl
Class FsIterator_subtypes_snapshot<T extends FeatureStructure>
- java.lang.Object
-
- org.apache.uima.cas.impl.FsIterator_subtypes_snapshot<T>
-
- All Implemented Interfaces:
java.util.Comparator<FeatureStructure>
,java.util.Iterator<T>
,java.util.ListIterator<T>
,FSIterator<T>
,LowLevelIterator<T>
- Direct Known Subclasses:
LLUnambiguousIteratorImpl
public class FsIterator_subtypes_snapshot<T extends FeatureStructure> extends java.lang.Object implements LowLevelIterator<T>, java.util.Comparator<FeatureStructure>
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Comparator<TOP>
comparatorMaybeNoTypeWithoutId
private LowLevelIndex<T>
indexForComparator
private boolean
is_unordered
support for alternative source iterating, where there is no orderprivate boolean
isNotUimaIndexSource
private int
pos
private T[]
snapshot
-
Fields inherited from interface org.apache.uima.cas.impl.LowLevelIterator
FS_ITERATOR_LOW_LEVEL_EMPTY, IS_ORDERED
-
-
Constructor Summary
Constructors Constructor Description FsIterator_subtypes_snapshot(FsIndex_flat<T> flatIndex, java.util.Comparator<TOP> comparatorMaybeNoTypeWithoutId)
FsIterator_subtypes_snapshot(T[] snapshot, LowLevelIndex<T> index, boolean is_unordered, java.util.Comparator<TOP> comparatorMaybeNoTypeWithoutId)
Alternative source iterator, 1st arg is different (not an "index", just an array) - altSources are unordered, and NoType is ignored - also supports backwards iterators, these are ordered (Maybe fix this in the future - this is not necessarily required)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(FeatureStructure fs1, FeatureStructure fs2)
FSIterator<T>
copy()
Copy this iterator.T
get()
Get the structure the iterator is pointing at.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
moveToNext()
Advance the iterator.void
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
moveToPrevious()
Move the iterator one element back.void
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 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
Methods inherited from interface org.apache.uima.cas.FSIterator
add, getType, hasNext, hasPrevious, 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
-
snapshot
private final T extends FeatureStructure[] snapshot
-
pos
private int pos
-
is_unordered
private final boolean is_unordered
support for alternative source iterating, where there is no order
-
indexForComparator
private final LowLevelIndex<T extends FeatureStructure> indexForComparator
-
isNotUimaIndexSource
private final boolean isNotUimaIndexSource
-
comparatorMaybeNoTypeWithoutId
private final java.util.Comparator<TOP> comparatorMaybeNoTypeWithoutId
-
-
Constructor Detail
-
FsIterator_subtypes_snapshot
public FsIterator_subtypes_snapshot(FsIndex_flat<T> flatIndex, java.util.Comparator<TOP> comparatorMaybeNoTypeWithoutId)
-
FsIterator_subtypes_snapshot
public FsIterator_subtypes_snapshot(T[] snapshot, LowLevelIndex<T> index, boolean is_unordered, java.util.Comparator<TOP> comparatorMaybeNoTypeWithoutId)
Alternative source iterator, 1st arg is different (not an "index", just an array) - altSources are unordered, and NoType is ignored - also supports backwards iterators, these are ordered (Maybe fix this in the future - this is not necessarily required)- Parameters:
snapshot
- -index
- -is_unordered
- - mark as unorderedcomparatorMaybeNoTypeWithoutId
- -
-
-
Method Detail
-
isValid
public boolean isValid()
Description copied from interface:FSIterator
Check if this iterator is valid.- Specified by:
isValid
in interfaceFSIterator<T extends FeatureStructure>
- Returns:
true
if the iterator is valid.
-
get
public T get() throws java.util.NoSuchElementException
Description copied from interface:FSIterator
Get the structure the iterator is pointing at.- Specified by:
get
in interfaceFSIterator<T extends FeatureStructure>
- Returns:
- The structure the iterator is pointing at.
- Throws:
java.util.NoSuchElementException
- If the iterator is not 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- Specified by:
getNvc
in interfaceFSIterator<T extends FeatureStructure>
- Returns:
- The structure the iterator is pointing at.
-
moveToNext
public void moveToNext()
Description copied from interface:FSIterator
Advance the iterator. This may invalidate the iterator.- Specified by:
moveToNext
in interfaceFSIterator<T extends FeatureStructure>
-
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- Specified by:
moveToNextNvc
in interfaceFSIterator<T extends FeatureStructure>
-
moveToPrevious
public void moveToPrevious()
Description copied from interface:FSIterator
Move the iterator one element back. This may invalidate the iterator.- Specified by:
moveToPrevious
in interfaceFSIterator<T extends FeatureStructure>
-
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- Specified by:
moveToPreviousNvc
in interfaceFSIterator<T extends FeatureStructure>
-
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- Specified by:
moveToFirstNoReinit
in interfaceLowLevelIterator<T extends FeatureStructure>
-
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- Specified by:
moveToLastNoReinit
in interfaceLowLevelIterator<T extends FeatureStructure>
-
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- Specified by:
moveToNoReinit
in interfaceLowLevelIterator<T extends FeatureStructure>
- Parameters:
fs
- the fs to use as the template identifying the place to move to
-
copy
public FSIterator<T> copy()
Description copied from interface:FSIterator
Copy this iterator.- Specified by:
copy
in interfaceFSIterator<T extends FeatureStructure>
- Returns:
- A copy of this iterator, pointing at the same element.
-
ll_indexSizeMaybeNotCurrent
public int ll_indexSizeMaybeNotCurrent()
- Specified by:
ll_indexSizeMaybeNotCurrent
in 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_maxAnnotSpan
public int ll_maxAnnotSpan()
- Specified by:
ll_maxAnnotSpan
in interfaceLowLevelIterator<T extends FeatureStructure>
- 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).- Specified by:
ll_getIndex
in interfaceLowLevelIterator<T extends FeatureStructure>
- Returns:
- The index.
-
compare
public int compare(FeatureStructure fs1, FeatureStructure fs2)
- Specified by:
compare
in interfacejava.util.Comparator<T extends FeatureStructure>
-
isIndexesHaveBeenUpdated
public boolean isIndexesHaveBeenUpdated()
- Specified by:
isIndexesHaveBeenUpdated
in 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:LowLevelIterator
Internal use- Specified by:
maybeReinitIterator
in interfaceLowLevelIterator<T extends FeatureStructure>
- Returns:
- true if the iterator was refreshed to match the current index
-
getComparator
public java.util.Comparator<TOP> getComparator()
- Specified by:
getComparator
in 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.
-
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.- Specified by:
size
in interfaceFSIterator<T extends FeatureStructure>
- Returns:
- the size of the collection being iterated over.
-
-