Class SelectFSs_impl<T extends FeatureStructure>

java.lang.Object
org.apache.uima.cas.impl.SelectFSs_impl<T>
All Implemented Interfaces:
AutoCloseable, Iterable<T>, BaseStream<T,Stream<T>>, Stream<T>, SelectFSs<T>

public class SelectFSs_impl<T extends FeatureStructure> extends 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
  • Constructor Details

    • SelectFSs_impl

      public SelectFSs_impl(CAS cas)
    • SelectFSs_impl

      public SelectFSs_impl(FSArray source)
    • SelectFSs_impl

      public SelectFSs_impl(FeatureStructure[] source, CAS cas)
    • SelectFSs_impl

      public SelectFSs_impl(FSList source)
  • Method Details

    • index

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

      public SelectFSs_impl<T> index(FSIndex<T> aIndex)
    • anyType

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

      public <N extends T> SelectFSs_impl<N> type(Type uimaType)
    • type

      public <N extends T> SelectFSs_impl<N> type(String fullyQualifiedTypeName)
    • type

      public <N extends T> SelectFSs_impl<N> type(int jcasClass_dot_type)
    • type

      public <N extends T> SelectFSs_impl<N> type(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
    • skipWhenSameBeginEndType

      public SelectFSs<T> skipWhenSameBeginEndType()
      boolean operations
      Specified by:
      skipWhenSameBeginEndType in interface SelectFSs<T extends FeatureStructure>
      Returns:
      the updated SelectFSs object
    • 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()
      Filters while iterating
      Specified by:
      nonOverlapping in interface SelectFSs<T extends FeatureStructure>
      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()
      Miscellaneous
      Specified by:
      allViews in interface SelectFSs<T extends FeatureStructure>
      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(AnnotationFS fs)
      subselection based on boundingFs
      Specified by:
      coveredBy in interface SelectFSs<T extends FeatureStructure>
      Parameters:
      fs - specifies the bounds.
      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
    • 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.
    • iterator

      public Iterator<T> iterator()
      Specified by:
      iterator in interface BaseStream<T extends FeatureStructure,Stream<T extends FeatureStructure>>
      Specified by:
      iterator in interface Iterable<T extends FeatureStructure>
    • asList

      public 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(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.
    • spliterator

      public 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 BaseStream<T extends FeatureStructure,Stream<T extends FeatureStructure>>
      Specified by:
      spliterator in interface 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
    • 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)
    • singleOrNull

      public T singleOrNull()
      Specified by:
      singleOrNull in interface SelectFSs<T extends FeatureStructure>
      Returns:
      first element, which may be null, or null if selection is empty.
    • 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
    • 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
    • filter

      public Stream<T> filter(Predicate<? super T> predicate)
      Specified by:
      filter in interface Stream<T extends FeatureStructure>
    • map

      public <R> Stream<R> map(Function<? super T,? extends R> mapper)
      Specified by:
      map in interface Stream<T extends FeatureStructure>
    • mapToInt

      public IntStream mapToInt(ToIntFunction<? super T> mapper)
      Specified by:
      mapToInt in interface Stream<T extends FeatureStructure>
    • mapToLong

      public LongStream mapToLong(ToLongFunction<? super T> mapper)
      Specified by:
      mapToLong in interface Stream<T extends FeatureStructure>
    • mapToDouble

      public DoubleStream mapToDouble(ToDoubleFunction<? super T> mapper)
      Specified by:
      mapToDouble in interface Stream<T extends FeatureStructure>
    • flatMap

      public <R> Stream<R> flatMap(Function<? super T,? extends Stream<? extends R>> mapper)
      Specified by:
      flatMap in interface Stream<T extends FeatureStructure>
    • flatMapToInt

      public IntStream flatMapToInt(Function<? super T,? extends IntStream> mapper)
      Specified by:
      flatMapToInt in interface Stream<T extends FeatureStructure>
    • flatMapToLong

      public LongStream flatMapToLong(Function<? super T,? extends LongStream> mapper)
      Specified by:
      flatMapToLong in interface Stream<T extends FeatureStructure>
    • flatMapToDouble

      public DoubleStream flatMapToDouble(Function<? super T,? extends DoubleStream> mapper)
      Specified by:
      flatMapToDouble in interface Stream<T extends FeatureStructure>
    • distinct

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

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

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

      public Stream<T> peek(Consumer<? super T> action)
      Specified by:
      peek in interface Stream<T extends FeatureStructure>
    • limit

      public Stream<T> limit(long maxSize)
      Specified by:
      limit in interface Stream<T extends FeatureStructure>
    • skip

      public Stream<T> skip(long n)
      Specified by:
      skip in interface Stream<T extends FeatureStructure>
    • forEach

      public void forEach(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 Iterable<T extends FeatureStructure>
      Specified by:
      forEach in interface SelectFSs<T extends FeatureStructure>
      Specified by:
      forEach in interface Stream<T extends FeatureStructure>
    • forEachOrdered

      public void forEachOrdered(Consumer<? super T> action)
      Specified by:
      forEachOrdered in interface Stream<T extends FeatureStructure>
    • toArray

      public Object[] toArray()
      Specified by:
      toArray in interface Stream<T extends FeatureStructure>
    • toArray

      public <A> A[] toArray(IntFunction<A[]> generator)
      Specified by:
      toArray in interface Stream<T extends FeatureStructure>
    • reduce

      public T reduce(T identity, BinaryOperator<T> accumulator)
      Specified by:
      reduce in interface Stream<T extends FeatureStructure>
    • reduce

      public Optional<T> reduce(BinaryOperator<T> accumulator)
      Specified by:
      reduce in interface Stream<T extends FeatureStructure>
    • reduce

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

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

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

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

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

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

      public boolean anyMatch(Predicate<? super T> predicate)
      Specified by:
      anyMatch in interface Stream<T extends FeatureStructure>
    • allMatch

      public boolean allMatch(Predicate<? super T> predicate)
      Specified by:
      allMatch in interface Stream<T extends FeatureStructure>
    • noneMatch

      public boolean noneMatch(Predicate<? super T> predicate)
      Specified by:
      noneMatch in interface Stream<T extends FeatureStructure>
    • findFirst

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

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

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

      public Stream<T> sequential()
      Specified by:
      sequential in interface BaseStream<T extends FeatureStructure,Stream<T extends FeatureStructure>>
    • parallel

      public Stream<T> parallel()
      Specified by:
      parallel in interface BaseStream<T extends FeatureStructure,Stream<T extends FeatureStructure>>
    • onClose

      public Stream<T> onClose(Runnable closeHandler)
      Specified by:
      onClose in interface BaseStream<T extends FeatureStructure,Stream<T extends FeatureStructure>>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface BaseStream<T extends FeatureStructure,Stream<T extends FeatureStructure>>
    • unordered

      public Stream<T> unordered()
      Specified by:
      unordered in interface BaseStream<T extends FeatureStructure,Stream<T extends FeatureStructure>>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface SelectFSs<T extends FeatureStructure>
      Returns:
      true if the selection is empty