Package org.apache.uima.cas.impl
Class FSIteratorAggregate<T extends FeatureStructure>
java.lang.Object
org.apache.uima.cas.impl.FSIteratorImplBase<T>
org.apache.uima.cas.impl.FSIteratorAggregate<T>
- All Implemented Interfaces:
Iterator<T>
,FSIterator<T>
Aggregate several FS iterators. Simply iterates over one after the other, no sorting or merging
of any kind occurs. Intended for use in
FSIndexRepositoryImpl.getAllIndexedFS(org.apache.uima.cas.Type)
.
Note: this class does not support moveTo(FS), as it is not sorted.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionThe one and only constructor. -
Method Summary
Modifier and TypeMethodDescriptioncopy()
Copy this iterator.get()
Get the structure the iterator is pointing at.(package private) int
getBegin()
(package private) int
getEnd()
boolean
isValid()
Check if this iterator is valid.(package private) <TT extends AnnotationFS>
voidmoveTo
(int begin, int end) A special version of moveTo for subtypes of AnnotationFS, which moves to a particular begin/end (no type priority).void
Move the iterator to the first Feature Structure that is equal tofs
.void
Move the iterator to the first element.void
Move the iterator to the last element.void
Advance the iterator.void
Move the iterator one element back.Methods inherited from class org.apache.uima.cas.impl.FSIteratorImplBase
hasNext, next, remove
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
iterators
-
iteratorIndex
private int iteratorIndex
-
-
Constructor Details
-
FSIteratorAggregate
The one and only constructor.- Parameters:
c
- Collection of input iterators.
-
-
Method Details
-
copy
Description copied from interface:FSIterator
Copy this iterator.- Returns:
- A copy of this iterator, pointing at the same element.
-
get
Description copied from interface:FSIterator
Get the structure the iterator is pointing at.- Returns:
- The structure the iterator is pointing at.
- Throws:
NoSuchElementException
- If the iterator is not valid.
-
isValid
public boolean isValid()Description copied from interface:FSIterator
Check if this iterator is valid.- Returns:
true
if the iterator is valid.
-
moveTo
Description copied from interface:FSIterator
Move the iterator to the first Feature Structure that is equal tofs
. First means the earliest one occurring in the index, in case multiple FSs that are "equal" to fs are in the index. If no such feature structure exists in the underlying collection, set the iterator to the "insertion point" forfs
, i.e., to a point where the current feature structure is greater thanfs
, and the previous one is less thanfs
.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 bag index, no ordering is present, and the moveTo operation moves to the fs which is the same identical fs as the key. If no such fs is in the index, the iterator is marked invalid.
- Parameters:
fs
- The feature structure the iterator that supplies the comparison information. It must be of type T or a subtype of T.
-
moveToFirst
public 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. -
moveToLast
public 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. -
moveToNext
public void moveToNext()Description copied from interface:FSIterator
Advance the iterator. This may invalidate the iterator. -
moveToPrevious
public void moveToPrevious()Description copied from interface:FSIterator
Move the iterator one element back. This may invalidate the iterator. -
getBegin
int getBegin()- Overrides:
getBegin
in classFSIteratorImplBase<T extends FeatureStructure>
-
getEnd
int getEnd()- Overrides:
getEnd
in classFSIteratorImplBase<T extends FeatureStructure>
-
moveTo
Description copied from class:FSIteratorImplBase
A special version of moveTo for subtypes of AnnotationFS, which moves to a particular begin/end (no type priority).- Overrides:
moveTo
in classFSIteratorImplBase<T extends FeatureStructure>
- Parameters:
begin
- the starting point (inclusive)end
- the ending point (inclusive)
-