public interface SelectFSs<T extends FeatureStructure> extends Iterable<T>, Stream<T>
Stream.Builder<T>
Modifier and Type | Method and Description |
---|---|
SelectFSs<T> |
allViews()
Extend the selection to be over all the CAS views, not just a single view.
|
SelectFSs<T> |
allViews(boolean allViews)
Extend or not extend the selection to be over all the CAS views, not just a single view.
|
T[] |
asArray(Class<? super T> clazz) |
List<T> |
asList() |
SelectFSs<T> |
at(AnnotationFS fs)
Subselection - specifies selecting Feature Structures having the same begin and end -
influenced by typePriority, positionUsesType, and useAnnotationEquals Requires an Annotation
Index.
|
SelectFSs<T> |
at(int begin,
int end)
Subselection - specifies selecting Feature Structures having the same begin and end Requires an
Annotation Index.
|
SelectFSs<T> |
backwards()
Specifies that the iteration should run in reverse order from normal.
|
SelectFSs<T> |
backwards(boolean backwards)
Specifies that the iteration should run in the normal or reverse order.
|
SelectFSs<T> |
between(AnnotationFS fs1,
AnnotationFS fs2)
Subselection - specifies selecting Feature Structures which lie between two annotations.
|
SelectFSs<T> |
coveredBy(AnnotationFS fs)
Subselection - specifies selecting Feature Structures starting (and maybe ending) within a
bounding Feature Structure - influenced by typePriority, positionUsesType, useAnnotationEquals,
includeAnnotationsWithEndBeyondBounds Requires an Annotation Index.
|
SelectFSs<T> |
coveredBy(int begin,
int end)
Subselection - specifies selecting Feature Structures starting (and maybe ending) within a
bounding Feature Structure Requires an Annotation Index.
|
SelectFSs<T> |
covering(AnnotationFS fs)
Subselection - specifies selecting Feature Structures starting before or equal to bounding
Feature Structure and ending at or beyond the bounding Feature Structure - influenced by
typePriority, positionUsesType, useAnnotationEquals Requires an Annotation Index.
|
SelectFSs<T> |
covering(int begin,
int end)
Subselection - specifies selecting Feature Structures starting before or equal to bounding
Feature Structure's begin and ending at or beyond the bounding Feature Structure's end Requires
an Annotation Index.
|
SelectFSs<T> |
following(Annotation annotation)
For AnnotationIndex, position to first Annotation whose begin >= fs.getEnd();
|
SelectFSs<T> |
following(Annotation annotation,
int offset)
For AnnotationIndex, position to first Annotation whose begin >= fs.getEnd() and then adjust
position by the offset
|
SelectFSs<T> |
following(int position)
Select
annotations that follow the specified document position (i.e. |
SelectFSs<T> |
following(int position,
int offset)
For AnnotationIndex, position to first Annotation whose begin >= position and then adjust
position by the offset.
|
default void |
forEach(Consumer<? super T> action)
This method is required, because the 2 interfaces inherited both define this and this is needed
to disambiguate Otherwise, get a compile error (but not on Eclipse...)
|
FSIterator<T> |
fsIterator() |
T |
get()
Get the first element or null if empty or the element at the first position is null.
|
T |
get(FeatureStructure fs)
Positions to the fs using moveTo(fs).
|
T |
get(FeatureStructure fs,
int offset)
Positions to the fs using moveTo(fs), followed by a shifted(offset).
|
T |
get(int offset)
Get the offset element or null if empty or the offset went outside the the selected elements.
|
T |
get(int begin,
int end)
Position using a temporary Annotation with its begin and end set to the arguments.
|
T |
get(int begin,
int end,
int offset)
Position using a temporary Annotation with its begin and end set to the arguments, followed by
shifted(offset).
|
T |
get(TOP fs)
Positions to the fs using moveTo(fs).
|
T |
get(TOP fs,
int offset)
Positions to the fs using moveTo(fs), followed by a shifted(offset).
|
SelectFSs<T> |
includeAnnotationsWithEndBeyondBounds()
Meaningful only for coveredBy, includes annotations where the end exceeds the bounding
annotation's end.
|
SelectFSs<T> |
includeAnnotationsWithEndBeyondBounds(boolean includeAnnotationsWithEndBeyondBounds)
Meaningful only for coveredBy, includes or filters out annotations where the end exceeds the
bounding annotation's end.
|
boolean |
isEmpty() |
SelectFSs<T> |
limit(int n)
Limits the number of Feature Structures returned by this select
|
SelectFSs<T> |
nonOverlapping()
Meaningful only for Annotation Indexes, specifies that iteration should return only annotations
which don't overlap with each other.
|
SelectFSs<T> |
nonOverlapping(boolean nonOverlapping)
Meaningful only for Annotation Indexes, specifies that iteration should or should not return
only annotations which don't overlap with each other.
|
SelectFSs<T> |
nullOK()
Applies to the various argument forms of the get and single methods.
|
SelectFSs<T> |
nullOK(boolean nullOk)
Applies to the various argument forms of the get and single methods.
|
SelectFSs<T> |
orderNotNeeded()
Specifies that order is not required while iterating over an otherwise ordered index.
|
SelectFSs<T> |
orderNotNeeded(boolean unordered)
Specifies that order is or is not required while iterating over an otherwise ordered index.
|
SelectFSs<T> |
preceding(Annotation annotation)
For AnnotationIndex, set up a selection that will go from the beginning to the first Annotation
to the left of the specified position, whose end <= fs.getBegin().
|
SelectFSs<T> |
preceding(Annotation annotation,
int offset)
For AnnotationIndex, set up a selection that will go from the beginning to the first Annotation
to the left of the specified position, ending at the last Annotation whose end <=
fs.getBegin(), after adjusting by offset items.
|
SelectFSs<T> |
preceding(int position)
Select
annotations that precede the specified document position (i.e. |
SelectFSs<T> |
preceding(int position,
int offset)
For AnnotationIndex, set up a selection that will go from the beginning to the first Annotation
to the left of the specified position, ending at the last Annotation whose end <= position.
|
static <U extends FeatureStructure> |
select(FSIndex<U> index)
Use this static method to capture the generic argument
|
SelectFSs<T> |
shifted(int shiftAmount)
Starting Position specification - Shifts the normal start position by the shiftAmount, which
may be negative.
|
T |
single() |
T |
single(FeatureStructure fs)
Positions to the fs using moveTo(fs).
|
T |
single(FeatureStructure fs,
int offset)
Positions to the fs using moveTo(fs), followed by a shifted(offset).
|
T |
single(int offset)
Get the offset element or null if empty or the offset went outside the the selected elements.
|
T |
single(int begin,
int end)
Position using a temporary Annotation with its begin and end set to the arguments.
|
T |
single(int begin,
int end,
int offset)
Position using a temporary Annotation with its begin and end set to the arguments, followed by
shifted(offset).
|
T |
single(TOP fs)
Positions to the fs using moveTo(fs).
|
T |
single(TOP fs,
int offset)
Positions to the fs using moveTo(fs), followed by a shifted(offset).
|
T |
singleOrNull() |
T |
singleOrNull(FeatureStructure fs)
Positions to the fs using moveTo(fs).
|
T |
singleOrNull(FeatureStructure fs,
int offset)
Positions to the fs using moveTo(fs), followed by a shifted(offset).
|
T |
singleOrNull(int offset)
Get the offset element or null if empty or the offset went outside the the selected elements.
|
T |
singleOrNull(int begin,
int end)
Position using a temporary Annotation with its begin and end set to the arguments.
|
T |
singleOrNull(int begin,
int end,
int offset)
Position using a temporary Annotation with its begin and end set to the arguments, followed by
shifted(offset).
|
T |
singleOrNull(TOP fs)
Positions to the fs using moveTo(fs).
|
T |
singleOrNull(TOP fs,
int offset)
Positions to the fs using moveTo(fs), followed by a shifted(offset).
|
SelectFSs<T> |
skipWhenSameBeginEndType()
Meaningful only for coveredBy and covering: if true, then returned annotations are compared
equal to the bounding annotation, and if equal, they are skipped.
|
default Spliterator<T> |
spliterator() |
SelectFSs<T> |
startAt(FeatureStructure fs)
Starting Position specification - For ordered sources, specifies which FS to start at.
|
SelectFSs<T> |
startAt(FeatureStructure fs,
int shift)
Starting Position specification - A combination of startAt followed by a shift
Requires an ordered index not necessarily AnnotationIndex, not necessarily sorted This versions
avoids a runtime cast check.
|
SelectFSs<T> |
startAt(int begin)
Starting Position specification - For Annotation Indexes, specifies which FS to start at.
|
SelectFSs<T> |
startAt(int begin,
int end)
Starting Position specification - For Annotation Indexes, specifies which FS to start at.
|
SelectFSs<T> |
startAt(int begin,
int end,
int shift)
Starting Position specification - A combination of startAt followed by a shift Requires an
Annotation Index.
|
SelectFSs<T> |
startAt(TOP fs)
Starting Position specification - For ordered sources, specifies which FS to start at.
|
SelectFSs<T> |
startAt(TOP fs,
int shift)
Starting Position specification - A combination of startAt followed by a shift
Requires an ordered index not necessarily AnnotationIndex, not necessarily sorted
|
SelectFSs<T> |
typePriority()
Specify that type priority should be included when comparing two Feature Structures when moving
to the leftmost among otherwise equal items for moveTo(fs).
|
SelectFSs<T> |
typePriority(boolean typePriority)
Specify that type priority should or should not be included when comparing two Feature
Structures while positioning an iterator
|
SelectFSs<T> |
useAnnotationEquals(boolean useAnnotationEquals)
Meaningful only for coveredBy: if true, then returned annotations are compared to the bounding
annotation using the specified kind of equal comparison, and if equal, they are skipped.
|
allMatch, anyMatch, builder, collect, collect, concat, count, distinct, empty, filter, findAny, findFirst, flatMap, flatMapToDouble, flatMapToInt, flatMapToLong, forEachOrdered, generate, iterate, limit, map, mapToDouble, mapToInt, mapToLong, max, min, noneMatch, of, of, peek, reduce, reduce, reduce, skip, sorted, sorted, toArray, toArray
close, isParallel, iterator, onClose, parallel, sequential, unordered
SelectFSs<T> typePriority()
Default is to not include type priority.
SelectFSs<T> typePriority(boolean typePriority)
Default is to not include type priority.
typePriority
- if true says to include the type prioritySelectFSs<T> nonOverlapping()
Default is to not have this filter.
SelectFSs<T> nonOverlapping(boolean nonOverlapping)
Default is to not have this filter.
nonOverlapping
- true to specify filtering for only non-overlapping annotations.SelectFSs<T> includeAnnotationsWithEndBeyondBounds()
Default is to NOT include annotations whose end exceeds the bounding annotation's end.
SelectFSs<T> includeAnnotationsWithEndBeyondBounds(boolean includeAnnotationsWithEndBeyondBounds)
Default is to NOT include annotations whose end exceeds the bounding annotation's end.
includeAnnotationsWithEndBeyondBounds
- false to filter out annotations whose end exceeds the bounding annotation's endSelectFSs<T> skipWhenSameBeginEndType()
Default is to use feature structure identity comparison (same id()s), not equals, when doing the test to see if an annotation should be skipped.
This is identical to useAnnotationEquals(true).
SelectFSs<T> useAnnotationEquals(boolean useAnnotationEquals)
Default is to use feature structure identity comparison (same id()s), not equals, when doing the test to see if an annotation should be skipped.
useAnnotationEquals
- if true, use equals, if false, use id() ==.SelectFSs<T> allViews()
Default is that the selection is just for one CAS view
SelectFSs<T> allViews(boolean allViews)
Default is that the selection is just for one CAS view
allViews
- true to extend the selection.SelectFSs<T> nullOK()
Calling this method is equivalent to nullOK(true). If never called, nulls are not OK by default.
SelectFSs<T> nullOK(boolean nullOk)
Default: null is not OK as a value
nullOk
- true if null is an ok value.SelectFSs<T> orderNotNeeded()
Default: order is required by default, when iterating over an ordered index.
SelectFSs<T> orderNotNeeded(boolean unordered)
Default: order is required by default, when iterating over an ordered index.
unordered
- true means order is not needed.SelectFSs<T> backwards()
SelectFSs<T> backwards(boolean backwards)
backwards
- true to run in reverse orderSelectFSs<T> shifted(int shiftAmount)
shiftAmount
- the amount to shift; this many Feature Structures which normally would be returned are
instead skipped.SelectFSs<T> startAt(TOP fs)
fs
- a Feature Structure specifying a starting position.SelectFSs<T> startAt(FeatureStructure fs)
fs
- a Feature Structure specifying a starting position.SelectFSs<T> startAt(int begin)
typePriority()
and turns type priorities off implicitly.
Do not turn type priorities back on. Positions to the leftmost (if there are multiple equal
ones) Annotation whose begin is >= beginbegin
- the begin boundSelectFSs<T> startAt(int begin, int end)
begin
- the begin boundend
- the end boundSelectFSs<T> startAt(TOP fs, int shift)
fs
- a Feature Structure specifying a starting position.shift
- the amount to shift; this many Feature Structures which normally would be returned are
instead skipped.SelectFSs<T> startAt(FeatureStructure fs, int shift)
fs
- a Feature Structure specifying a starting position.shift
- the amount to shift; this many Feature Structures which normally would be returned are
instead skipped.SelectFSs<T> startAt(int begin, int end, int shift)
begin
- the begin boundend
- the end boundshift
- the amount to shift; this many Feature Structures which normally would be returned are
instead skipped.SelectFSs<T> limit(int n)
n
- the maximum number of feature structures returned. This must be a value >= 0.SelectFSs<T> at(AnnotationFS fs)
fs
- specifies the bounds.SelectFSs<T> at(int begin, int end)
begin
- the begin boundend
- the end boundSelectFSs<T> coveredBy(AnnotationFS fs)
fs
- specifies the bounds.SelectFSs<T> coveredBy(int begin, int end)
begin
- the begin boundend
- the end boundSelectFSs<T> covering(AnnotationFS fs)
fs
- specifies the bounds.SelectFSs<T> covering(int begin, int end)
begin
- the begin boundend
- the end boundSelectFSs<T> between(AnnotationFS fs1, AnnotationFS fs2)
If fs1 > fs2, they are swapped.
fs1
- the beginning boundfs2
- the ending boundSelectFSs<T> following(Annotation annotation)
annotation
- the Annotation to followSelectFSs<T> following(int position)
annotations
that follow the specified document position (i.e.
character offset). This is equivalent to performing a
following(new Annotation(jcas, 0, position)
, so all annotations starting at
position
or after are returned, including zero-width annotations.position
- start following this positionSelectFSs<T> following(Annotation annotation, int offset)
annotation
- start following this Annotation, adjusted for the offsetoffset
- positive or negative shift amount to adjust starting positionSelectFSs<T> following(int position, int offset)
position
- start following this position, adjusted for the offsetoffset
- positive or negative shift amount to adjust starting positionSelectFSs<T> preceding(Annotation annotation)
annotation
- the Annotation to use as the position to start before.SelectFSs<T> preceding(int position)
annotations
that precede the specified document position (i.e.
character offset). This is equivalent to performing a
preceding(new Annotation(jcas, position, Integer.MAX_VALUE)
, so all annotations ending
at position
or before are returned, including zero-width annotations.position
- start following this positionSelectFSs<T> preceding(Annotation annotation, int offset)
annotation
- the Annotation to use as the position to start before.offset
- the offset adjustment, positive or negative. Positive moves backwards.SelectFSs<T> preceding(int position, int offset)
position
- the position to start before.offset
- the offset adjustment, positive or negative. Positive moves backwards.FSIterator<T> fsIterator()
T[] asArray(Class<? super T> clazz)
clazz
- the class of the type of the elementsT get()
CASRuntimeException
- conditioned on nullOK == false, and null being returned or the selection is empty.T single()
CASRuntimeException
- (conditioned on nullOK == false ) if element is null or if there is more than 1
element in the selection, or if the selection is emptyT singleOrNull()
CASRuntimeException
- if there is more than 1 element in the selection.T get(int offset)
If nullOK is false, then throws CASRuntimeException if null would have been returned, or the selection is empty, or doesn't have enough elements to satisfy the positioning.
offset
- the offset adjustment, positive or negative.CASRuntimeException
- conditioned on nullOK == false, and null being returned or the selection is empty, or
the offset positioning going outside the elements in the selection.T single(int offset)
If, after positioning, there is another element next to the one being returned (in the forward direction if offset is positive, reverse direction if offset is negative) then throw an exception.
If nullOK is false, then throws CASRuntimeException if null would have been returned, or the selection is empty, or doesn't have enough elements to satisfy the positioning.
offset
- the offset adjustment, positive or negative.CASRuntimeException
- if, after positioning, there is another element next to the one being returned (in
the forward direction if offset is positive, reverse direction if offset is negative)
or (conditioned on nullOK == false) null being returned or the selection is empty, or
the offset positioning going outside the elements in the selection.T singleOrNull(int offset)
If, after positioning, there is another element next to the one being returned (in the forward direction if offset is positive, reverse direction if offset is negative) then throw an exception.
offset
- the offset adjustment, positive or negative.CASRuntimeException
- if, after positioning, there is another element next to the one being returned (in
the forward direction if offset is positive, reverse direction if offset is negative)T get(TOP fs)
fs
- the positioning Feature StructureCASRuntimeException
- (conditioned on nullOK == false) null being returned or the selection is empty.T get(FeatureStructure fs)
fs
- the positioning Feature StructureCASRuntimeException
- (conditioned on nullOK == false) null being returned or the selection is empty.T single(TOP fs)
fs
- the positioning Feature StructureCASRuntimeException
- if, after positioning, there is another element following the one being returned or
(conditioned on nullOK == false) and null being returned or the selection is empty.T single(FeatureStructure fs)
fs
- the positioning Feature StructureCASRuntimeException
- if, after positioning, there is another element following the one being returned or
(conditioned on nullOK == false) and null being returned or the selection is empty.T singleOrNull(TOP fs)
fs
- the positioning Feature StructureCASRuntimeException
- if, after positioning, there is another element following the one being returnedT singleOrNull(FeatureStructure fs)
fs
- the positioning Feature StructureCASRuntimeException
- if, after positioning, there is another element following the one being returnedT get(TOP fs, int offset)
fs
- where to move tooffset
- the offset move after positioning to fs, may be 0 or positive or negativeCASRuntimeException
- (conditioned on nullOK == false) null being returned or the selection is empty.T get(FeatureStructure fs, int offset)
fs
- where to move tooffset
- the offset move after positioning to fs, may be 0 or positive or negativeCASRuntimeException
- (conditioned on nullOK == false) null being returned or the selection is empty.T single(TOP fs, int offset)
If, after positioning, there is another element next to the one being returned (in the forward direction if offset is positive or 0, reverse direction if offset is negative) then throw an exception.
If nullOK is false, then throws CASRuntimeException if null would have been returned. This versions avoids a runtime cast check.
fs
- the positioning Feature Structureoffset
- the offset adjustment, positive or negative.CASRuntimeException
- if, after positioning, there is another element following the one being returned or
(conditioned on nullOK == false) null being returned or the selection is empty.T single(FeatureStructure fs, int offset)
If, after positioning, there is another element next to the one being returned (in the forward direction if offset is positive or 0, reverse direction if offset is negative) then throw an exception.
If nullOK is false, then throws CASRuntimeException if null would have been returned.
fs
- the positioning Feature Structureoffset
- the offset adjustment, positive or negative.CASRuntimeException
- if, after positioning, there is another element following the one being returned or
(conditioned on nullOK == false) null being returned or the selection is empty.T singleOrNull(TOP fs, int offset)
If, after positioning, there is another element next to the one being returned (in the forward direction if offset is positive or 0, reverse direction if offset is negative) then throw an exception.
This versions avoids a runtime cast check.
fs
- the positioning Feature Structureoffset
- the offset adjustment, positive or negative.CASRuntimeException
- if, after positioning, there is another element next to the one being returnedT singleOrNull(FeatureStructure fs, int offset)
If, after positioning, there is another element next to the one being returned (in the forward direction if offset is positive or 0, reverse direction if offset is negative) then throw an exception.
fs
- the positioning Feature Structureoffset
- the offset adjustment, positive or negative.CASRuntimeException
- if, after positioning, there is another element next to the one being returnedT get(int begin, int end)
begin
- the begin position of the temporary Annotationend
- the end position of the temporary AnnotationCASRuntimeException
- conditioned on nullOK == false, and null being returned or the selection is empty.T single(int begin, int end)
If, after positioning, there is another element following the one being returned then throw an exception.
if nullOK is false, then throws CASRuntimeException if null would have been returned.
begin
- the begin position of the temporary Annotationend
- the end position of the temporary AnnotationCASRuntimeException
- if, after positioning, there is another element following the one being returned or
(conditioned on nullOK == false) null being returned or the selection is empty.T singleOrNull(int begin, int end)
If, after positioning, there is another element following the one being returned then throw an exception.
begin
- the begin position of the temporary Annotationend
- the end position of the temporary AnnotationCASRuntimeException
- if, after positioning, there is another element following the one being returnedT get(int begin, int end, int offset)
begin
- the begin position of the temporary Annotationend
- the end position of the temporary Annotationoffset
- the amount (positive or negative or 0) passed as an argument to shifted(int)CASRuntimeException
- (conditioned on nullOK == false) if null being returned or the selection is empty.T single(int begin, int end, int offset)
If, after positioning, there is another element next to the one being returned (in the forward direction if offset is positive or 0, reverse direction if offset is negative) then throw an exception.
begin
- the begin position of the temporary Annotationend
- the end position of the temporary Annotationoffset
- the amount (positive or negative or 0) passed as an argument to shifted(int)CASRuntimeException
- if, after positioning, there is another element next to the one being returned or
(conditioned on nullOK == false) if null being returned or the selection is empty.T singleOrNull(int begin, int end, int offset)
If, after positioning, there is another element next to the one being returned (in the forward direction if offset is positive or 0, reverse direction if offset is negative) then throw an exception.
begin
- the begin position of the temporary Annotationend
- the end position of the temporary Annotationoffset
- the amount (positive or negative or 0) passed as an argument to shifted(int)CASRuntimeException
- if, after positioning, there is another element next to the one being returneddefault Spliterator<T> spliterator()
spliterator
in interface BaseStream<T extends FeatureStructure,Stream<T extends FeatureStructure>>
spliterator
in interface Iterable<T extends FeatureStructure>
static <U extends FeatureStructure> SelectFSs<U> select(FSIndex<U> index)
U
- generic type of indexindex
- - the index to select over as a sourcedefault void forEach(Consumer<? super T> action)
forEach
in interface Iterable<T extends FeatureStructure>
forEach
in interface Stream<T extends FeatureStructure>
boolean isEmpty()
Copyright © 2006–2022 The Apache Software Foundation. All rights reserved.