Class SelectFSs_impl<T extends FeatureStructure>

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.lang.Iterable<T>, java.util.stream.BaseStream<T,​java.util.stream.Stream<T>>, java.util.stream.Stream<T>, SelectFSs<T>

    public class SelectFSs_impl<T extends FeatureStructure>
    extends java.lang.Object
    implements SelectFSs<T>
    Collection of builder style methods to specify selection of FSs from indexes shift handled in this routine Comment codes: AI = implies AnnotationIndex Iterator varieties and impl bounded? type order not unambig? strict? skipEq Priority? Needed? no coveredBy covering sameas for not-bounded, - ignore strict and skipEq -- except: preceding implies skipping annotations whose end > positioning begin - order-not-needed only applies if iicp size > 1 - unambig ==> use Subiterator -- subiterator wraps: according to typePriority and order-not-needed - no Type Priority - need to pass in as arg to fsIterator_multiple_indexes == if no type priority, need to prevent rattling off the == type while compare is equal == affects both FsIterator_aggregation_common and FsIterator_subtypes_ordered for 3 other boundings: - use subiterator, pass in strict and skipeq finish this javadoc comment edit T extends FeatureStructure, not TOP, because of ref from FSIndex which uses FeatureStructure for backwards compatibility
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private class  SelectFSs_impl.SelectFSIterator  
      • Nested classes/interfaces inherited from interface java.util.stream.Stream

        java.util.stream.Stream.Builder<T extends java.lang.Object>
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean allMatch​(java.util.function.Predicate<? super T> predicate)  
      SelectFSs_impl<T> allViews()
      Miscellaneous
      SelectFSs_impl<T> allViews​(boolean bAllViews)
      Extend or not extend the selection to be over all the CAS views, not just a single view.
      private LowLevelIterator<T> altSourceIterator()  
      boolean anyMatch​(java.util.function.Predicate<? super T> predicate)  
      <N extends T>
      SelectFSs_impl<N>
      anyType()
      Select the index's uppermost type.
      T[] asArray​(java.lang.Class<? super T> clazz)  
      private T[] asArray​(LowLevelIterator<T> it, java.lang.Class<? super T> clazz)
      This is a terminal operation, so can use/modify the original iterator
      private java.util.ArrayList<T> asArrayList​(LowLevelIterator<T> it)  
      java.util.ArrayList<T> asList()  
      SelectFSs<T> at​(int begin, int end)
      Subselection - specifies selecting Feature Structures having the same begin and end Requires an Annotation Index.
      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_impl<T> backwards()
      Specifies that the iteration should run in reverse order from normal.
      SelectFSs_impl<T> backwards​(boolean bBackwards)
      Specifies that the iteration should run in the normal or reverse order.
      SelectFSs_impl<T> between​(AnnotationFS fs1, AnnotationFS fs2)
      Subselection - specifies selecting Feature Structures which lie between two annotations.
      void close()  
      <R> R collect​(java.util.function.Supplier<R> supplier, java.util.function.BiConsumer<R,​? super T> accumulator, java.util.function.BiConsumer<R,​R> combiner)  
      <R,​A>
      R
      collect​(java.util.stream.Collector<? super T,​A,​R> collector)  
      private SelectFSs<T> commonFollowing​(Annotation annotation, int offset)
      validations isAnnotationIndex => startingFs is Annotation isAllViews: doesn't support startAt, coveredBy and friends, backwards isAllViews: supports limit, shift
      private SelectFSs<T> commonPreceding​(Annotation annotation, int offset)  
      long count()  
      SelectFSs_impl<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_impl<T> coveredBy​(AnnotationFS fs)
      subselection based on boundingFs
      SelectFSs_impl<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_impl<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.
      private FsIterator_aggregation_common<T> createFsIterator_for_all_views()
      for a selected index, return an iterator over all the views for that index
      java.util.stream.Stream<T> distinct()  
      java.util.stream.Stream<T> filter​(java.util.function.Predicate<? super T> predicate)  
      java.util.Optional<T> findAny()  
      java.util.Optional<T> findFirst()  
      <R> java.util.stream.Stream<R> flatMap​(java.util.function.Function<? super T,​? extends java.util.stream.Stream<? extends R>> mapper)  
      java.util.stream.DoubleStream flatMapToDouble​(java.util.function.Function<? super T,​? extends java.util.stream.DoubleStream> mapper)  
      java.util.stream.IntStream flatMapToInt​(java.util.function.Function<? super T,​? extends java.util.stream.IntStream> mapper)  
      java.util.stream.LongStream flatMapToLong​(java.util.function.Function<? super T,​? extends java.util.stream.LongStream> mapper)  
      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.
      SelectFSs<T> following​(Annotation fs)
      For AnnotationIndex, position to first Annotation whose begin >= fs.getEnd();
      SelectFSs<T> following​(Annotation fs, int offset)
      For AnnotationIndex, position to first Annotation whose begin >= fs.getEnd() and then adjust position by the offset
      private void forceAnnotationIndex()  
      void forEach​(java.util.function.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...)
      void forEachOrdered​(java.util.function.Consumer<? super T> action)  
      FSIterator<T> fsIterator()
      F S I t e r a t o r -------------------
      private LowLevelIterator<T> fsIterator1()  
      T get()
      Get the first element or null if empty or the element at the first position is null.
      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​(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​(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).
      private LowLevelIndex<T> getIndexForView​(CASImpl v)
      gets the index for a view that corresponds to the specified index by matching the index specs and type code
      private T getNullChk()  
      SelectFSs_impl<T> includeAnnotationsWithEndBeyondBounds()
      Meaningful only for coveredBy, includes annotations where the end exceeds the bounding annotation's end.
      SelectFSs_impl<T> includeAnnotationsWithEndBeyondBounds​(boolean includeAnnotationsWithEndBeyondBounds)
      Meaningful only for coveredBy, includes or filters out annotations where the end exceeds the bounding annotation's end.
      private void incr​(FSIterator<T> it)  
      SelectFSs_impl<T> index​(java.lang.String indexName)
      INDEX If not specified, defaults to all FSs (orderNotNeeded) unless AnnotationIndex implied
      SelectFSs_impl<T> index​(FSIndex<T> aIndex)  
      boolean isEmpty()  
      boolean isParallel()  
      java.util.Iterator<T> iterator()  
      SelectFSs_impl<T> limit​(int alimit)
      Limits the number of Feature Structures returned by this select
      java.util.stream.Stream<T> limit​(long maxSize)  
      private LowLevelIterator<T> make_or_copy_snapshot​(LowLevelIterator<T> baseIterator, boolean bkwd)  
      private Annotation makePosAnnot​(int begin, int end)  
      <R> java.util.stream.Stream<R> map​(java.util.function.Function<? super T,​? extends R> mapper)  
      java.util.stream.DoubleStream mapToDouble​(java.util.function.ToDoubleFunction<? super T> mapper)  
      java.util.stream.IntStream mapToInt​(java.util.function.ToIntFunction<? super T> mapper)  
      java.util.stream.LongStream mapToLong​(java.util.function.ToLongFunction<? super T> mapper)  
      java.util.Optional<T> max​(java.util.Comparator<? super T> comparator)  
      private LowLevelIterator<T> maybeLimit​(LowLevelIterator<T> it)  
      private java.lang.String maybeMsgPosition()  
      private FSIterator<T> maybePosition​(FSIterator<T> it)
      works for AnnotationIndex or general index position taken from startingFs (not necessarily an Annotation subtype) - goes to left-most "equal" using comparator, or if none equal, to the first one > startingFs -- using moveTo(fs) special processing for AnnotationIndex (only): - typePriority - use or ignore -- ignored: after moveTo(fs), moveToPrevious while begin and end == // REMOVED see https://issues.apache.org/jira/browse/UIMA-5536 --- and if isPositionUsesType types are ==
      private FSIterator<T> maybeShift​(FSIterator<T> it)  
      private void maybeValidateAltSource()  
      private LowLevelIterator<T> maybeWrapBackwards​(LowLevelIterator<T> it)  
      java.util.Optional<T> min​(java.util.Comparator<? super T> comparator)  
      boolean noneMatch​(java.util.function.Predicate<? super T> predicate)  
      SelectFSs_impl<T> nonOverlapping()
      Filters while iterating
      SelectFSs_impl<T> nonOverlapping​(boolean bNonOverlapping)
      Meaningful only for Annotation Indexes, specifies that iteration should or should not return only annotations which don't overlap with each other.
      SelectFSs_impl<T> nullOK()
      Applies to the various argument forms of the get and single methods.
      SelectFSs_impl<T> nullOK​(boolean bNullOk)
      Applies to the various argument forms of the get and single methods.
      java.util.stream.Stream<T> onClose​(java.lang.Runnable closeHandler)  
      SelectFSs_impl<T> orderNotNeeded()
      Specifies that order is not required while iterating over an otherwise ordered index.
      SelectFSs_impl<T> orderNotNeeded​(boolean bUnordered)
      Specifies that order is or is not required while iterating over an otherwise ordered index.
      java.util.stream.Stream<T> parallel()  
      java.util.stream.Stream<T> peek​(java.util.function.Consumer<? super T> action)  
      private LowLevelIterator<T> plainFsIterator​(LowLevelIndex<T> idx, CASImpl v)  
      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.
      SelectFSs<T> preceding​(Annotation fs)
      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.
      private void prepareTerminalOp()  
      java.util.Optional<T> reduce​(java.util.function.BinaryOperator<T> accumulator)  
      T reduce​(T identity, java.util.function.BinaryOperator<T> accumulator)  
      <U> U reduce​(U identity, java.util.function.BiFunction<U,​? super T,​U> accumulator, java.util.function.BinaryOperator<U> combiner)  
      java.util.stream.Stream<T> sequential()  
      SelectFSs_impl<T> shifted​(int shiftAmount)
      starting position
      T single()  
      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​(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​(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​(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​(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​(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).
      java.util.stream.Stream<T> skip​(long n)  
      SelectFSs<T> skipWhenSameBeginEndType()
      boolean operations
      java.util.stream.Stream<T> sorted()  
      java.util.stream.Stream<T> sorted​(java.util.Comparator<? super T> comparator)  
      java.util.Spliterator<T> spliterator()
      Iterator respects backwards Sets the characteristics from the context: IMMUTABLE / NONNULL / DISTINCT - always CONCURRENT - never ORDERED - unless orderNotNeeded index or not SORTED_INDEX or SET_INDEX SORTED - only for SORTED_INDEX (and not orderNotNeeded?) SIZED - if exact size is (easily) known, just from index.
      SelectFSs_impl<T> startAt​(int begin)
      Starting Position specification - For Annotation Indexes, specifies which FS to start at.
      SelectFSs_impl<T> startAt​(int begin, int end)
      Starting Position specification - For Annotation Indexes, specifies which FS to start at.
      SelectFSs_impl<T> startAt​(int begin, int end, int offset)
      Starting Position specification - A combination of startAt followed by a shift Requires an Annotation Index.
      SelectFSs_impl<T> startAt​(FeatureStructure fs)
      Starting Position specification - For ordered sources, specifies which FS to start at.
      SelectFSs_impl<T> startAt​(FeatureStructure fs, int offset)
      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_impl<T> startAt​(TOP fs)
      Starting Position specification - For ordered sources, specifies which FS to start at.
      SelectFSs_impl<T> startAt​(TOP fs, int offset)
      Starting Position specification - A combination of startAt followed by a shift Requires an ordered index not necessarily AnnotationIndex, not necessarily sorted
      private java.util.stream.Stream<T> stream()  
      java.lang.Object[] toArray()  
      <A> A[] toArray​(java.util.function.IntFunction<A[]> generator)  
      <N extends T>
      SelectFSs_impl<N>
      type​(int jcasClass_dot_type)  
      <N extends T>
      SelectFSs_impl<N>
      type​(java.lang.Class<N> jcasClass_dot_class)  
      <N extends T>
      SelectFSs_impl<N>
      type​(java.lang.String fullyQualifiedTypeName)  
      <N extends T>
      SelectFSs_impl<N>
      type​(Type uimaType)  
      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 aTypePriority)
      Specify that type priority should or should not be included when comparing two Feature Structures while positioning an iterator
      java.util.stream.Stream<T> unordered()  
      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.
      (package private) boolean usesTypePriority()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • shift

        private int shift
      • limit

        private int limit
      • sourceFSList

        private FSList sourceFSList
      • isTypePriority

        private boolean isTypePriority
      • isSkipSameBeginEndType

        private boolean isSkipSameBeginEndType
      • isNonOverlapping

        private boolean isNonOverlapping
      • isIncludeAnnotBeyondBounds

        private boolean isIncludeAnnotBeyondBounds
      • isAllViews

        private boolean isAllViews
      • isNullOK

        private boolean isNullOK
      • isUnordered

        private boolean isUnordered
      • isBackwards

        private boolean isBackwards
      • isFollowing

        private boolean isFollowing
      • isPreceding

        private boolean isPreceding
      • isAltSource

        private boolean isAltSource
      • startingFs

        private TOP startingFs
        This is used for non-annotation positioning too Used for preceding since we tweak the end offset of the reference annotation
      • noResult

        private boolean noResult
    • Constructor Detail

      • SelectFSs_impl

        public SelectFSs_impl​(CAS cas)
      • SelectFSs_impl

        public SelectFSs_impl​(FSArray source)
      • SelectFSs_impl

        public SelectFSs_impl​(FSList source)
    • Method Detail

      • index

        public SelectFSs_impl<T> index​(java.lang.String indexName)
        INDEX If not specified, defaults to all FSs (orderNotNeeded) unless AnnotationIndex implied
        Parameters:
        indexName - -
        Returns:
        -
      • anyType

        public <N extends TSelectFSs_impl<N> anyType()
        Select the index's uppermost type.
      • type

        public <N extends TSelectFSs_impl<N> type​(java.lang.String fullyQualifiedTypeName)
      • type

        public <N extends TSelectFSs_impl<N> type​(int jcasClass_dot_type)
      • type

        public <N extends TSelectFSs_impl<N> type​(java.lang.Class<N> jcasClass_dot_class)
      • typePriority

        public SelectFSs<T> typePriority()
        Description copied from interface: SelectFSs
        Specify that type priority should be included when comparing two Feature Structures when moving to the leftmost among otherwise equal items for moveTo(fs).

        Default is to not include type priority.

        Specified by:
        typePriority in interface SelectFSs<T extends FeatureStructure>
        Returns:
        the updated SelectFSs object
      • typePriority

        public SelectFSs<T> typePriority​(boolean aTypePriority)
        Description copied from interface: SelectFSs
        Specify that type priority should or should not be included when comparing two Feature Structures while positioning an iterator

        Default is to not include type priority.

        Specified by:
        typePriority in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        aTypePriority - if true says to include the type priority
        Returns:
        the updated SelectFSs object
      • usesTypePriority

        boolean usesTypePriority()
      • useAnnotationEquals

        public SelectFSs<T> useAnnotationEquals​(boolean useAnnotationEquals)
        Description copied from interface: SelectFSs
        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.

        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.

        Specified by:
        useAnnotationEquals in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        useAnnotationEquals - if true, use equals, if false, use id() ==.
        Returns:
        the updated SelectFSs object
      • nonOverlapping

        public SelectFSs_impl<T> nonOverlapping​(boolean bNonOverlapping)
        Description copied from interface: SelectFSs
        Meaningful only for Annotation Indexes, specifies that iteration should or should not return only annotations which don't overlap with each other. Also known as "unambiguous".

        Default is to not have this filter.

        Specified by:
        nonOverlapping in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        bNonOverlapping - true to specify filtering for only non-overlapping annotations.
        Returns:
        the updated SelectFSs object
      • includeAnnotationsWithEndBeyondBounds

        public SelectFSs_impl<T> includeAnnotationsWithEndBeyondBounds()
        Description copied from interface: SelectFSs
        Meaningful only for coveredBy, includes annotations where the end exceeds the bounding annotation's end.

        Default is to NOT include annotations whose end exceeds the bounding annotation's end.

        Specified by:
        includeAnnotationsWithEndBeyondBounds in interface SelectFSs<T extends FeatureStructure>
        Returns:
        the updated SelectFSs object
      • includeAnnotationsWithEndBeyondBounds

        public SelectFSs_impl<T> includeAnnotationsWithEndBeyondBounds​(boolean includeAnnotationsWithEndBeyondBounds)
        Description copied from interface: SelectFSs
        Meaningful only for coveredBy, includes or filters out annotations where the end exceeds the bounding annotation's end.

        Default is to NOT include annotations whose end exceeds the bounding annotation's end.

        Specified by:
        includeAnnotationsWithEndBeyondBounds in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        includeAnnotationsWithEndBeyondBounds - false to filter out annotations whose end exceeds the bounding annotation's end
        Returns:
        the updated SelectFSs object
      • allViews

        public SelectFSs_impl<T> allViews​(boolean bAllViews)
        Description copied from interface: SelectFSs
        Extend or not extend the selection to be over all the CAS views, not just a single view.

        Default is that the selection is just for one CAS view

        Specified by:
        allViews in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        bAllViews - true to extend the selection.
        Returns:
        the updated SelectFSs object
      • nullOK

        public SelectFSs_impl<T> nullOK()
        Description copied from interface: SelectFSs
        Applies to the various argument forms of the get and single methods. Indicates that a null value should not throw an exception.

        Calling this method is equivalent to nullOK(true). If never called, nulls are not OK by default.

        Specified by:
        nullOK in interface SelectFSs<T extends FeatureStructure>
        Returns:
        the updated SelectFSs object
      • nullOK

        public SelectFSs_impl<T> nullOK​(boolean bNullOk)
        Description copied from interface: SelectFSs
        Applies to the various argument forms of the get and single methods. Indicates that a null value should or should not throw an exception.

        Default: null is not OK as a value

        Specified by:
        nullOK in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        bNullOk - true if null is an ok value.
        Returns:
        the updated SelectFSs object
      • orderNotNeeded

        public SelectFSs_impl<T> orderNotNeeded()
        Description copied from interface: SelectFSs
        Specifies that order is not required while iterating over an otherwise ordered index. This can be a performance boost for hierarchically nested types.

        Default: order is required by default, when iterating over an ordered index.

        Specified by:
        orderNotNeeded in interface SelectFSs<T extends FeatureStructure>
        Returns:
        the updated SelectFSs object
      • orderNotNeeded

        public SelectFSs_impl<T> orderNotNeeded​(boolean bUnordered)
        Description copied from interface: SelectFSs
        Specifies that order is or is not required while iterating over an otherwise ordered index. This can be a performance boost for hierarchically nested types.

        Default: order is required by default, when iterating over an ordered index.

        Specified by:
        orderNotNeeded in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        bUnordered - true means order is not needed.
        Returns:
        the updated SelectFSs object
      • backwards

        public SelectFSs_impl<T> backwards()
        Description copied from interface: SelectFSs
        Specifies that the iteration should run in reverse order from normal. Note that this does not compose; two calls to this will still result in the iteration running in reverse order.
        Specified by:
        backwards in interface SelectFSs<T extends FeatureStructure>
        Returns:
        the updated SelectFSs object
      • backwards

        public SelectFSs_impl<T> backwards​(boolean bBackwards)
        Description copied from interface: SelectFSs
        Specifies that the iteration should run in the normal or reverse order. Note that this does not compose.
        Specified by:
        backwards in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        bBackwards - true to run in reverse order
        Returns:
        the updated SelectFSs object
      • shifted

        public SelectFSs_impl<T> shifted​(int shiftAmount)
        starting position
        Specified by:
        shifted in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        shiftAmount - the amount to shift; this many Feature Structures which normally would be returned are instead skipped.
        Returns:
        the updated SelectFSs object
      • startAt

        public SelectFSs_impl<T> startAt​(FeatureStructure fs)
        Description copied from interface: SelectFSs
        Starting Position specification - For ordered sources, specifies which FS to start at. Requires an ordered index not necessarily AnnotationIndex, not necessarily sorted
        Specified by:
        startAt in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - a Feature Structure specifying a starting position.
        Returns:
        the updated SelectFSs object
      • startAt

        public SelectFSs_impl<T> startAt​(TOP fs)
        Description copied from interface: SelectFSs
        Starting Position specification - For ordered sources, specifies which FS to start at. Requires an ordered index not necessarily AnnotationIndex, not necessarily sorted
        Specified by:
        startAt in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - a Feature Structure specifying a starting position.
        Returns:
        the updated SelectFSs object
      • startAt

        public SelectFSs_impl<T> startAt​(int begin)
        Description copied from interface: SelectFSs
        Starting Position specification - For Annotation Indexes, specifies which FS to start at. This method is incompatible with SelectFSs.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 >= begin
        Specified by:
        startAt in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        begin - the begin bound
        Returns:
        the updated SelectFSs object
      • startAt

        public SelectFSs_impl<T> startAt​(int begin,
                                         int end)
        Description copied from interface: SelectFSs
        Starting Position specification - For Annotation Indexes, specifies which FS to start at.
        Specified by:
        startAt in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        begin - the begin bound
        end - the end bound
        Returns:
        the updated SelectFSs object
      • startAt

        public SelectFSs_impl<T> startAt​(TOP fs,
                                         int offset)
        Description copied from interface: SelectFSs
        Starting Position specification - A combination of startAt followed by a shift Requires an ordered index not necessarily AnnotationIndex, not necessarily sorted
        Specified by:
        startAt in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - a Feature Structure specifying a starting position.
        offset - the amount to shift; this many Feature Structures which normally would be returned are instead skipped.
        Returns:
        the updated SelectFSs object
      • startAt

        public SelectFSs_impl<T> startAt​(FeatureStructure fs,
                                         int offset)
        Description copied from interface: SelectFSs
        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.
        Specified by:
        startAt in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - a Feature Structure specifying a starting position.
        offset - the amount to shift; this many Feature Structures which normally would be returned are instead skipped.
        Returns:
        the updated SelectFSs object
      • startAt

        public SelectFSs_impl<T> startAt​(int begin,
                                         int end,
                                         int offset)
        Description copied from interface: SelectFSs
        Starting Position specification - A combination of startAt followed by a shift Requires an Annotation Index.
        Specified by:
        startAt in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        begin - the begin bound
        end - the end bound
        offset - the amount to shift; this many Feature Structures which normally would be returned are instead skipped.
        Returns:
        the updated SelectFSs object
      • limit

        public SelectFSs_impl<T> limit​(int alimit)
        Description copied from interface: SelectFSs
        Limits the number of Feature Structures returned by this select
        Specified by:
        limit in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        alimit - the maximum number of feature structures returned. This must be a value >= 0.
        Returns:
        the updated SelectFSs object
      • coveredBy

        public SelectFSs_impl<T> coveredBy​(int begin,
                                           int end)
        Description copied from interface: SelectFSs
        Subselection - specifies selecting Feature Structures starting (and maybe ending) within a bounding Feature Structure Requires an Annotation Index.
        Specified by:
        coveredBy in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        begin - the begin bound
        end - the end bound
        Returns:
        the updated SelectFSs object
      • covering

        public SelectFSs_impl<T> covering​(AnnotationFS fs)
        Description copied from interface: SelectFSs
        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.
        Specified by:
        covering in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - specifies the bounds.
        Returns:
        the updated SelectFSs object
      • covering

        public SelectFSs_impl<T> covering​(int begin,
                                          int end)
        Description copied from interface: SelectFSs
        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.
        Specified by:
        covering in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        begin - the begin bound
        end - the end bound
        Returns:
        the updated SelectFSs object
      • between

        public SelectFSs_impl<T> between​(AnnotationFS fs1,
                                         AnnotationFS fs2)
        Description copied from interface: SelectFSs
        Subselection - specifies selecting Feature Structures which lie between two annotations. A bounding Annotation is constructed whose begin is the end of fs1, and whose end is the begin of fs2. Requires an Annotation Index.

        If fs1 > fs2, they are swapped.

        Specified by:
        between in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs1 - the beginning bound
        fs2 - the ending bound
        Returns:
        the updated SelectFSs object
      • at

        public SelectFSs<T> at​(AnnotationFS fs)
        Description copied from interface: SelectFSs
        Subselection - specifies selecting Feature Structures having the same begin and end - influenced by typePriority, positionUsesType, and useAnnotationEquals Requires an Annotation Index.
        Specified by:
        at in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - specifies the bounds.
        Returns:
        the updated SelectFSs object
      • at

        public SelectFSs<T> at​(int begin,
                               int end)
        Description copied from interface: SelectFSs
        Subselection - specifies selecting Feature Structures having the same begin and end Requires an Annotation Index. - influenced by typePriority, positionUsesType, and useAnnotationEquals
        Specified by:
        at in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        begin - the begin bound
        end - the end bound
        Returns:
        the updated SelectFSs object
      • maybeMsgPosition

        private java.lang.String maybeMsgPosition()
      • prepareTerminalOp

        private void prepareTerminalOp()
      • maybeValidateAltSource

        private void maybeValidateAltSource()
      • fsIterator

        public FSIterator<T> fsIterator()
        F S I t e r a t o r -------------------
        Specified by:
        fsIterator in interface SelectFSs<T extends FeatureStructure>
        Returns:
        an FSIterator over the selection. The iterator is set up depending on preceding configuration calls to this SelectFSs instance.
      • createFsIterator_for_all_views

        private FsIterator_aggregation_common<T> createFsIterator_for_all_views()
        for a selected index, return an iterator over all the views for that index
        Returns:
        iterator over all views for that index, unordered
      • getIndexForView

        private LowLevelIndex<T> getIndexForView​(CASImpl v)
        gets the index for a view that corresponds to the specified index by matching the index specs and type code
        Parameters:
        v - -
        Returns:
        -
      • plainFsIterator

        private LowLevelIterator<T> plainFsIterator​(LowLevelIndex<T> idx,
                                                    CASImpl v)
        Parameters:
        idx - the index selected, corresponds to a type + its subtypes, or if null, either an alternate source or means all types
        v - the cas
        Returns:
        an iterator
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.util.stream.BaseStream<T extends FeatureStructure,​java.util.stream.Stream<T extends FeatureStructure>>
        Specified by:
        iterator in interface java.lang.Iterable<T extends FeatureStructure>
      • asList

        public java.util.ArrayList<T> asList()
        Specified by:
        asList in interface SelectFSs<T extends FeatureStructure>
        Returns:
        a List object whose elements represent the selection.
      • asArray

        public T[] asArray​(java.lang.Class<? super T> clazz)
        Specified by:
        asArray in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        clazz - the class of the type of the elements
        Returns:
        a Array object representation of the elements of the selection.
      • asArray

        private T[] asArray​(LowLevelIterator<T> it,
                            java.lang.Class<? super T> clazz)
        This is a terminal operation, so can use/modify the original iterator
        Parameters:
        it - the iterator positioned at the start position
        clazz - the class of the result
        Returns:
        an array of elements from the position to the end
      • makePosAnnot

        private Annotation makePosAnnot​(int begin,
                                        int end)
      • spliterator

        public java.util.Spliterator<T> spliterator()
        Iterator respects backwards Sets the characteristics from the context: IMMUTABLE / NONNULL / DISTINCT - always CONCURRENT - never ORDERED - unless orderNotNeeded index or not SORTED_INDEX or SET_INDEX SORTED - only for SORTED_INDEX (and not orderNotNeeded?) SIZED - if exact size is (easily) known, just from index. false if bounded, unambiguous SUBSIZED - if spliterator result from trysplit also is SIZED, set to true for now trySplit impl: always returns null (no parallelism support for now)
        Specified by:
        spliterator in interface java.util.stream.BaseStream<T extends FeatureStructure,​java.util.stream.Stream<T extends FeatureStructure>>
        Specified by:
        spliterator in interface java.lang.Iterable<T extends FeatureStructure>
        Specified by:
        spliterator in interface SelectFSs<T extends FeatureStructure>
        Returns:
        the spliterator
      • get

        public T get()
        Description copied from interface: SelectFSs
        Get the first element or null if empty or the element at the first position is null. if nullOK is false, then throws CASRuntimeException if null would have been returned.
        Specified by:
        get in interface SelectFSs<T extends FeatureStructure>
        Returns:
        first element or null if empty
      • getNullChk

        private T getNullChk()
      • single

        public T single()
        Specified by:
        single in interface SelectFSs<T extends FeatureStructure>
        Returns:
        first element, verifying that the size of the selection is 1 (or maybe 0)
      • get

        public T get​(int offset)
        Description copied from interface: SelectFSs
        Get the offset element or null if empty or the offset went outside the the selected elements.

        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.

        Specified by:
        get in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        offset - the offset adjustment, positive or negative.
        Returns:
        the selected element or null
      • single

        public T single​(int offset)
        Description copied from interface: SelectFSs
        Get the offset element or null if empty or the offset went outside the the selected elements.

        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.

        Specified by:
        single in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        offset - the offset adjustment, positive or negative.
        Returns:
        the selected element or null
      • singleOrNull

        public T singleOrNull​(int offset)
        Description copied from interface: SelectFSs
        Get the offset element or null if empty or the offset went outside the the selected elements.

        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.

        Specified by:
        singleOrNull in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        offset - the offset adjustment, positive or negative.
        Returns:
        the selected element or null
      • get

        public T get​(TOP fs)
        Description copied from interface: SelectFSs
        Positions to the fs using moveTo(fs). Get the element at that position or null if empty or the element at that position is null. if nullOK is false, then throws CASRuntimeException if null would have been returned. This versions avoids a runtime cast check.
        Specified by:
        get in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - the positioning Feature Structure
        Returns:
        first element or null if empty
      • get

        public T get​(FeatureStructure fs)
        Description copied from interface: SelectFSs
        Positions to the fs using moveTo(fs). Get the element at that position or null if empty or the element at that position is null. if nullOK is false, then throws CASRuntimeException if null would have been returned.
        Specified by:
        get in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - the positioning Feature Structure
        Returns:
        first element or null if empty
      • single

        public T single​(TOP fs)
        Description copied from interface: SelectFSs
        Positions to the fs using moveTo(fs). Get the element at that position or null if empty or the element at that position is null. if nullOK is false, then throws CASRuntimeException if null would have been returned. This versions avoids a runtime cast check.
        Specified by:
        single in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - the positioning Feature Structure
        Returns:
        first element or null if empty
      • single

        public T single​(FeatureStructure fs)
        Description copied from interface: SelectFSs
        Positions to the fs using moveTo(fs). Get the element at that position or null if empty or the element at that position is null. if nullOK is false, then throws CASRuntimeException if null would have been returned.
        Specified by:
        single in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - the positioning Feature Structure
        Returns:
        first element or null if empty
      • singleOrNull

        public T singleOrNull​(TOP fs)
        Description copied from interface: SelectFSs
        Positions to the fs using moveTo(fs). Get the element at that position or null if empty or the element at that position is null. This versions avoids a runtime cast check.
        Specified by:
        singleOrNull in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - the positioning Feature Structure
        Returns:
        first element or null if empty
      • singleOrNull

        public T singleOrNull​(FeatureStructure fs)
        Description copied from interface: SelectFSs
        Positions to the fs using moveTo(fs). Get the element at that position or null if empty or the element at that position is null.
        Specified by:
        singleOrNull in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - the positioning Feature Structure
        Returns:
        first element or null if empty
      • get

        public T get​(TOP fs,
                     int offset)
        Description copied from interface: SelectFSs
        Positions to the fs using moveTo(fs), followed by a shifted(offset). Gets the element at that position or null if empty or the element at that position is null. if nullOK is false, then throws CASRuntimeException if null would have been returned. This versions avoids a runtime cast check.
        Specified by:
        get in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - where to move to
        offset - the offset move after positioning to fs, may be 0 or positive or negative
        Returns:
        the selected element or null if empty
      • get

        public T get​(FeatureStructure fs,
                     int offset)
        Description copied from interface: SelectFSs
        Positions to the fs using moveTo(fs), followed by a shifted(offset). Gets the element at that position or null if empty or the element at that position is null. if nullOK is false, then throws CASRuntimeException if null would have been returned.
        Specified by:
        get in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - where to move to
        offset - the offset move after positioning to fs, may be 0 or positive or negative
        Returns:
        the selected element or null if empty
      • single

        public T single​(TOP fs,
                        int offset)
        Description copied from interface: SelectFSs
        Positions to the fs using moveTo(fs), followed by a shifted(offset). Gets the element at that position or null if empty or the element at that position is null.

        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.

        Specified by:
        single in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - the positioning Feature Structure
        offset - the offset adjustment, positive or negative.
        Returns:
        the selected element or null if empty
      • single

        public T single​(FeatureStructure fs,
                        int offset)
        Description copied from interface: SelectFSs
        Positions to the fs using moveTo(fs), followed by a shifted(offset). Gets the element at that position or null if empty or the element at that position is null.

        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.

        Specified by:
        single in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - the positioning Feature Structure
        offset - the offset adjustment, positive or negative.
        Returns:
        the selected element or null if empty
      • singleOrNull

        public T singleOrNull​(TOP fs,
                              int offset)
        Description copied from interface: SelectFSs
        Positions to the fs using moveTo(fs), followed by a shifted(offset). Gets the element at that position or null if empty or the element at that position is null.

        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.

        Specified by:
        singleOrNull in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - the positioning Feature Structure
        offset - the offset adjustment, positive or negative.
        Returns:
        the selected element or null if empty
      • singleOrNull

        public T singleOrNull​(FeatureStructure fs,
                              int offset)
        Description copied from interface: SelectFSs
        Positions to the fs using moveTo(fs), followed by a shifted(offset). Gets the element at that position or null if empty or the element at that position is null.

        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.

        Specified by:
        singleOrNull in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - the positioning Feature Structure
        offset - the offset adjustment, positive or negative.
        Returns:
        the selected element or null if empty
      • get

        public T get​(int begin,
                     int end)
        Description copied from interface: SelectFSs
        Position using a temporary Annotation with its begin and end set to the arguments. Gets the element at that position or null if empty or the element at that position is null. if nullOK is false, then throws CASRuntimeException if null would have been returned. This versions avoids a runtime cast check.
        Specified by:
        get in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        begin - the begin position of the temporary Annotation
        end - the end position of the temporary Annotation
        Returns:
        the selected element or null if empty
      • single

        public T single​(int begin,
                        int end)
        Description copied from interface: SelectFSs
        Position using a temporary Annotation with its begin and end set to the arguments. Gets the element at that position or null if empty or the element at that position is null.

        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.

        Specified by:
        single in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        begin - the begin position of the temporary Annotation
        end - the end position of the temporary Annotation
        Returns:
        the selected element or null if empty
      • singleOrNull

        public T singleOrNull​(int begin,
                              int end)
        Description copied from interface: SelectFSs
        Position using a temporary Annotation with its begin and end set to the arguments. Gets the element at that position or null if empty or the element at that position is null.

        If, after positioning, there is another element following the one being returned then throw an exception.

        Specified by:
        singleOrNull in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        begin - the begin position of the temporary Annotation
        end - the end position of the temporary Annotation
        Returns:
        the selected element or null if empty
      • get

        public T get​(int begin,
                     int end,
                     int offset)
        Description copied from interface: SelectFSs
        Position using a temporary Annotation with its begin and end set to the arguments, followed by shifted(offset). Gets the element at that position or null if empty or the element at that position is null.

        Specified by:
        get in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        begin - the begin position of the temporary Annotation
        end - the end position of the temporary Annotation
        offset - the amount (positive or negative or 0) passed as an argument to shifted(int)
        Returns:
        the selected element or null if empty
      • single

        public T single​(int begin,
                        int end,
                        int offset)
        Description copied from interface: SelectFSs
        Position using a temporary Annotation with its begin and end set to the arguments, followed by shifted(offset). Gets the element at that position or null if empty or the element at that position is null.

        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.

        Specified by:
        single in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        begin - the begin position of the temporary Annotation
        end - the end position of the temporary Annotation
        offset - the amount (positive or negative or 0) passed as an argument to shifted(int)
        Returns:
        the selected element or null if empty
      • singleOrNull

        public T singleOrNull​(int begin,
                              int end,
                              int offset)
        Description copied from interface: SelectFSs
        Position using a temporary Annotation with its begin and end set to the arguments, followed by shifted(offset). Gets the element at that position or null if empty or the element at that position is null.

        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.

        Specified by:
        singleOrNull in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        begin - the begin position of the temporary Annotation
        end - the end position of the temporary Annotation
        offset - the amount (positive or negative or 0) passed as an argument to shifted(int)
        Returns:
        the selected element or null if empty
      • maybePosition

        private FSIterator<T> maybePosition​(FSIterator<T> it)
        works for AnnotationIndex or general index position taken from startingFs (not necessarily an Annotation subtype) - goes to left-most "equal" using comparator, or if none equal, to the first one > startingFs -- using moveTo(fs) special processing for AnnotationIndex (only): - typePriority - use or ignore -- ignored: after moveTo(fs), moveToPrevious while begin and end == // REMOVED see https://issues.apache.org/jira/browse/UIMA-5536 --- and if isPositionUsesType types are ==
        Parameters:
        it - iterator to position
        Returns:
        it positioned if needed
      • following

        public SelectFSs<T> following​(Annotation fs)
        Description copied from interface: SelectFSs
        For AnnotationIndex, position to first Annotation whose begin >= fs.getEnd();
        Specified by:
        following in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - the Annotation to follow
        Returns:
        the updated SelectFSs object
      • following

        public SelectFSs<T> following​(int position)
        Description copied from interface: SelectFSs
        Select 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.
        Specified by:
        following in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        position - start following this position
        Returns:
        the updated SelectFSs object
      • following

        public SelectFSs<T> following​(Annotation fs,
                                      int offset)
        Description copied from interface: SelectFSs
        For AnnotationIndex, position to first Annotation whose begin >= fs.getEnd() and then adjust position by the offset
        Specified by:
        following in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - start following this Annotation, adjusted for the offset
        offset - positive or negative shift amount to adjust starting position
        Returns:
        the updated SelectFSs object
      • following

        public SelectFSs<T> following​(int position,
                                      int offset)
        Description copied from interface: SelectFSs
        For AnnotationIndex, position to first Annotation whose begin >= position and then adjust position by the offset.
        Specified by:
        following in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        position - start following this position, adjusted for the offset
        offset - positive or negative shift amount to adjust starting position
        Returns:
        the updated SelectFSs object
      • preceding

        public SelectFSs<T> preceding​(Annotation fs)
        Description copied from interface: SelectFSs
        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(). Annotations whose end > fs.getBegin() are skipped.
        Specified by:
        preceding in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        fs - the Annotation to use as the position to start before.
        Returns:
        the updated SelectFSs object
      • preceding

        public SelectFSs<T> preceding​(int position)
        Description copied from interface: SelectFSs
        Select 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.
        Specified by:
        preceding in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        position - start following this position
        Returns:
        the updated SelectFSs object
      • preceding

        public SelectFSs<T> preceding​(Annotation annotation,
                                      int offset)
        Description copied from interface: SelectFSs
        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. Annotations whose end > fs.getBegin() are skipped (including during the offset positioning)
        Specified by:
        preceding in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        annotation - the Annotation to use as the position to start before.
        offset - the offset adjustment, positive or negative. Positive moves backwards.
        Returns:
        the updated SelectFSs object
      • preceding

        public SelectFSs<T> preceding​(int position,
                                      int offset)
        Description copied from interface: SelectFSs
        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. after adjusting by offset items. Annotations whose end > position are skipped (including during the offset positioning)
        Specified by:
        preceding in interface SelectFSs<T extends FeatureStructure>
        Parameters:
        position - the position to start before.
        offset - the offset adjustment, positive or negative. Positive moves backwards.
        Returns:
        the updated SelectFSs object
      • commonFollowing

        private SelectFSs<T> commonFollowing​(Annotation annotation,
                                             int offset)
        validations isAnnotationIndex => startingFs is Annotation isAllViews: doesn't support startAt, coveredBy and friends, backwards isAllViews: supports limit, shift
      • forceAnnotationIndex

        private void forceAnnotationIndex()
      • stream

        private java.util.stream.Stream<T> stream()
      • filter

        public java.util.stream.Stream<T> filter​(java.util.function.Predicate<? super T> predicate)
        Specified by:
        filter in interface java.util.stream.Stream<T extends FeatureStructure>
      • map

        public <R> java.util.stream.Stream<R> map​(java.util.function.Function<? super T,​? extends R> mapper)
        Specified by:
        map in interface java.util.stream.Stream<T extends FeatureStructure>
      • mapToInt

        public java.util.stream.IntStream mapToInt​(java.util.function.ToIntFunction<? super T> mapper)
        Specified by:
        mapToInt in interface java.util.stream.Stream<T extends FeatureStructure>
      • mapToLong

        public java.util.stream.LongStream mapToLong​(java.util.function.ToLongFunction<? super T> mapper)
        Specified by:
        mapToLong in interface java.util.stream.Stream<T extends FeatureStructure>
      • mapToDouble

        public java.util.stream.DoubleStream mapToDouble​(java.util.function.ToDoubleFunction<? super T> mapper)
        Specified by:
        mapToDouble in interface java.util.stream.Stream<T extends FeatureStructure>
      • flatMap

        public <R> java.util.stream.Stream<R> flatMap​(java.util.function.Function<? super T,​? extends java.util.stream.Stream<? extends R>> mapper)
        Specified by:
        flatMap in interface java.util.stream.Stream<T extends FeatureStructure>
      • flatMapToInt

        public java.util.stream.IntStream flatMapToInt​(java.util.function.Function<? super T,​? extends java.util.stream.IntStream> mapper)
        Specified by:
        flatMapToInt in interface java.util.stream.Stream<T extends FeatureStructure>
      • flatMapToLong

        public java.util.stream.LongStream flatMapToLong​(java.util.function.Function<? super T,​? extends java.util.stream.LongStream> mapper)
        Specified by:
        flatMapToLong in interface java.util.stream.Stream<T extends FeatureStructure>
      • flatMapToDouble

        public java.util.stream.DoubleStream flatMapToDouble​(java.util.function.Function<? super T,​? extends java.util.stream.DoubleStream> mapper)
        Specified by:
        flatMapToDouble in interface java.util.stream.Stream<T extends FeatureStructure>
      • distinct

        public java.util.stream.Stream<T> distinct()
        Specified by:
        distinct in interface java.util.stream.Stream<T extends FeatureStructure>
      • sorted

        public java.util.stream.Stream<T> sorted()
        Specified by:
        sorted in interface java.util.stream.Stream<T extends FeatureStructure>
      • sorted

        public java.util.stream.Stream<T> sorted​(java.util.Comparator<? super T> comparator)
        Specified by:
        sorted in interface java.util.stream.Stream<T extends FeatureStructure>
      • peek

        public java.util.stream.Stream<T> peek​(java.util.function.Consumer<? super T> action)
        Specified by:
        peek in interface java.util.stream.Stream<T extends FeatureStructure>
      • limit

        public java.util.stream.Stream<T> limit​(long maxSize)
        Specified by:
        limit in interface java.util.stream.Stream<T extends FeatureStructure>
      • skip

        public java.util.stream.Stream<T> skip​(long n)
        Specified by:
        skip in interface java.util.stream.Stream<T extends FeatureStructure>
      • forEach

        public void forEach​(java.util.function.Consumer<? super T> action)
        Description copied from interface: SelectFSs
        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...)
        Specified by:
        forEach in interface java.lang.Iterable<T extends FeatureStructure>
        Specified by:
        forEach in interface SelectFSs<T extends FeatureStructure>
        Specified by:
        forEach in interface java.util.stream.Stream<T extends FeatureStructure>
      • forEachOrdered

        public void forEachOrdered​(java.util.function.Consumer<? super T> action)
        Specified by:
        forEachOrdered in interface java.util.stream.Stream<T extends FeatureStructure>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.stream.Stream<T extends FeatureStructure>
      • toArray

        public <A> A[] toArray​(java.util.function.IntFunction<A[]> generator)
        Specified by:
        toArray in interface java.util.stream.Stream<T extends FeatureStructure>
      • reduce

        public T reduce​(T identity,
                        java.util.function.BinaryOperator<T> accumulator)
        Specified by:
        reduce in interface java.util.stream.Stream<T extends FeatureStructure>
      • reduce

        public java.util.Optional<T> reduce​(java.util.function.BinaryOperator<T> accumulator)
        Specified by:
        reduce in interface java.util.stream.Stream<T extends FeatureStructure>
      • reduce

        public <U> U reduce​(U identity,
                            java.util.function.BiFunction<U,​? super T,​U> accumulator,
                            java.util.function.BinaryOperator<U> combiner)
        Specified by:
        reduce in interface java.util.stream.Stream<T extends FeatureStructure>
      • collect

        public <R> R collect​(java.util.function.Supplier<R> supplier,
                             java.util.function.BiConsumer<R,​? super T> accumulator,
                             java.util.function.BiConsumer<R,​R> combiner)
        Specified by:
        collect in interface java.util.stream.Stream<T extends FeatureStructure>
      • collect

        public <R,​A> R collect​(java.util.stream.Collector<? super T,​A,​R> collector)
        Specified by:
        collect in interface java.util.stream.Stream<T extends FeatureStructure>
      • min

        public java.util.Optional<T> min​(java.util.Comparator<? super T> comparator)
        Specified by:
        min in interface java.util.stream.Stream<T extends FeatureStructure>
      • max

        public java.util.Optional<T> max​(java.util.Comparator<? super T> comparator)
        Specified by:
        max in interface java.util.stream.Stream<T extends FeatureStructure>
      • count

        public long count()
        Specified by:
        count in interface java.util.stream.Stream<T extends FeatureStructure>
      • anyMatch

        public boolean anyMatch​(java.util.function.Predicate<? super T> predicate)
        Specified by:
        anyMatch in interface java.util.stream.Stream<T extends FeatureStructure>
      • allMatch

        public boolean allMatch​(java.util.function.Predicate<? super T> predicate)
        Specified by:
        allMatch in interface java.util.stream.Stream<T extends FeatureStructure>
      • noneMatch

        public boolean noneMatch​(java.util.function.Predicate<? super T> predicate)
        Specified by:
        noneMatch in interface java.util.stream.Stream<T extends FeatureStructure>
      • findFirst

        public java.util.Optional<T> findFirst()
        Specified by:
        findFirst in interface java.util.stream.Stream<T extends FeatureStructure>
      • findAny

        public java.util.Optional<T> findAny()
        Specified by:
        findAny in interface java.util.stream.Stream<T extends FeatureStructure>
      • isParallel

        public boolean isParallel()
        Specified by:
        isParallel in interface java.util.stream.BaseStream<T extends FeatureStructure,​java.util.stream.Stream<T extends FeatureStructure>>
      • sequential

        public java.util.stream.Stream<T> sequential()
        Specified by:
        sequential in interface java.util.stream.BaseStream<T extends FeatureStructure,​java.util.stream.Stream<T extends FeatureStructure>>
      • parallel

        public java.util.stream.Stream<T> parallel()
        Specified by:
        parallel in interface java.util.stream.BaseStream<T extends FeatureStructure,​java.util.stream.Stream<T extends FeatureStructure>>
      • onClose

        public java.util.stream.Stream<T> onClose​(java.lang.Runnable closeHandler)
        Specified by:
        onClose in interface java.util.stream.BaseStream<T extends FeatureStructure,​java.util.stream.Stream<T extends FeatureStructure>>
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.util.stream.BaseStream<T extends FeatureStructure,​java.util.stream.Stream<T extends FeatureStructure>>
      • unordered

        public java.util.stream.Stream<T> unordered()
        Specified by:
        unordered in interface java.util.stream.BaseStream<T extends FeatureStructure,​java.util.stream.Stream<T extends FeatureStructure>>