Class FSIndexRepositoryImpl.IndexImpl<T extends FeatureStructure>

java.lang.Object
org.apache.uima.cas.impl.FSIndexRepositoryImpl.IndexImpl<T>
Type Parameters:
T - - the particular type (and it subtypes) this particular index is associated with
All Implemented Interfaces:
Iterable<T>, FSIndex<T>, FSIndexImpl, LowLevelIndex
Enclosing class:
FSIndexRepositoryImpl

class FSIndexRepositoryImpl.IndexImpl<T extends FeatureStructure> extends Object implements FSIndex<T>, FSIndexImpl
Implementation of a particular index for a particular Type (and its subtypes)
  • Field Details

  • Constructor Details

  • Method Details

    • ll_compare

      public int ll_compare(int ref1, int ref2)
      Specified by:
      ll_compare in interface LowLevelIndex
    • getIndexingStrategy

      public int getIndexingStrategy()
      Description copied from interface: FSIndex
      Return the indexing strategy.
      Specified by:
      getIndexingStrategy in interface FSIndex<T extends FeatureStructure>
      Returns:
      One of SORTED_INDEX, BAG_INDEX or SET_INDEX.
      See Also:
    • getComparator

      public FSIndexComparator getComparator()
      Specified by:
      getComparator in interface FSIndexImpl
      Returns:
      the FSIndexComparator structure used by this index
      See Also:
      • invalid reference
        org.apache.uima.cas.FSIndexImpl#getComparator()
    • flush

      public void flush()
      Specified by:
      flush in interface FSIndexImpl
    • compare

      public int compare(FeatureStructure fs1, FeatureStructure fs2)
      Description copied from interface: FSIndex
      Compare two feature structures according to the ordering relation of the index. If the input feature structures are not of the type of the index, the result is undefined.
      Specified by:
      compare in interface FSIndex<T extends FeatureStructure>
      Parameters:
      fs1 - the first Feature Structure to compare
      fs2 - the second Feature Structure to compare
      Returns:
      -1 if fs1 < fs2; 0 if fs1 = fs2; 1 else.
      See Also:
    • contains

      public boolean contains(FeatureStructure fs)
      Description copied from interface: FSIndex
      Check if the index contains an element equal to the given feature structure according to the comparators defined for this index. For bag indexes (which have no comparators), the equality test means the identical feature structure. Note that this is in general not the same as feature structure identity.
      Specified by:
      contains in interface FSIndex<T extends FeatureStructure>
      Parameters:
      fs - A Feature Structure used a template to match for equality with the FSs in the index.
      Returns:
      true if the index contains such an element.
      See Also:
    • find

      Description copied from interface: FSIndex
      Find an entry in the index "equal to" the given feature structure according to the comparators specified for this index. Note that this is in general not the same as feature structure identity. For BAG indexes, it is identity, for others it means the found feature structure compares equal with the parameter in terms of the defined comparators for the index.
      Specified by:
      find in interface FSIndex<T extends FeatureStructure>
      Parameters:
      fs - A Feature Structure used a template to match with the Feature Structures in the index.
      Returns:
      A FS equal to the template argument, or null if no such FS exists.
      See Also:
    • getType

      public Type getType()
      Description copied from interface: FSIndex
      Return the type of feature structures this index contains.
      Specified by:
      getType in interface FSIndex<T extends FeatureStructure>
      Returns:
      The type of feature structures in this index.
      See Also:
    • iterator

      public FSIterator<T> iterator()
      Description copied from interface: FSIndex
      Return an iterator over the index. The iterator will be set to the start position of the index.
      Specified by:
      iterator in interface FSIndex<T extends FeatureStructure>
      Specified by:
      iterator in interface Iterable<T extends FeatureStructure>
      Returns:
      An iterator over the index.
      See Also:
    • iterator

      public FSIterator<T> iterator(FeatureStructure fs)
      Description copied from interface: FSIndex
      Return an iterator over the index. The position of the iterator will be set such that the feature structure returned by a call to the iterator's get() method is greater than or equal to fs, and any previous FS is less than FS (the iterator is positioned at the earliest of equal values). If no such position exists, the iterator will be invalid.
      Specified by:
      iterator in interface FSIndex<T extends FeatureStructure>
      Parameters:
      fs - The feature structure at which the iterator should be positioned.
      Returns:
      An iterator positioned at fs, if it exists. An invalid iterator, else.
      See Also:
    • nonFlatIterator

      private FSIterator<T> nonFlatIterator(FeatureStructure fs, boolean respectUnordered)
    • getIntIterator

      public IntPointerIterator getIntIterator()
      Specified by:
      getIntIterator in interface FSIndexImpl
    • size

      public int size()
      Description copied from interface: FSIndex
      Return the number of feature structures in this index.
      Specified by:
      size in interface FSIndex<T extends FeatureStructure>
      Specified by:
      size in interface LowLevelIndex
      Returns:
      The number of FSs in this index.
      See Also:
    • ll_iterator

      public LowLevelIterator ll_iterator()
      Description copied from interface: LowLevelIndex
      Get a low-level, FS reference iterator.
      Specified by:
      ll_iterator in interface LowLevelIndex
      Returns:
      An iterator for this index.
    • ll_rootIterator

      public LowLevelIterator ll_rootIterator()
      Description copied from interface: LowLevelIndex
      Get a low-level, FS reference iterator specifying instances of the precise type only (i.e. without listing the subtypes).
      Specified by:
      ll_rootIterator in interface LowLevelIndex
      Returns:
      An iterator for the root type of this index.
    • ll_iterator

      public LowLevelIterator ll_iterator(boolean ambiguous)
      Description copied from interface: LowLevelIndex
      Get a low-level, FS reference iterator. This iterator can be disambiguated. This means that only non-overlapping annotations will be returned. Non-annotation FSs will be filtered in this mode.
      Specified by:
      ll_iterator in interface LowLevelIndex
      Parameters:
      ambiguous - When set to false, iterator will be disambiguated.
      Returns:
      An iterator for this index.
    • withSnapshotIterators

      public FSIndex<T> withSnapshotIterators()
      Description copied from interface: FSIndex
      Creates a shared copy of this FSIndex configured to produce snapshot iterators that don't throw ConcurrentModificationExceptions.
      Specified by:
      withSnapshotIterators in interface FSIndex<T extends FeatureStructure>
      Returns:
      a light-weight copy of this FSIndex, configured such that any iterator created using it will be a snapshot iterator - one where a snapshot is made of the state of the index at the time the iterator is created, and where subsequent modifications to the underlying index are allowed, but don't affect the iterator (which iterates over the read-only snapshot). Iterators produced with this won't throw ConcurrentModificationExceptions.
      See Also:
    • getFsRepositoryImpl

      FSIndexRepositoryImpl getFsRepositoryImpl()