org.apache.uima.cas.impl

## Class FSBagIndex<T extends FeatureStructure>

- java.lang.Object
- - org.apache.uima.cas.impl.FSLeafIndexImpl<T>
  - - org.apache.uima.cas.impl.FSBagIndex<T>

- Type Parameters:
    `T` - the Java cover class type for this index, passed along to (wrapped) iterators producing Java cover classes
  All Implemented Interfaces:
    Comparator<T>, FSIndexImpl, LowLevelIndex, org.apache.uima.internal.util.IntComparator

      public class FSBagIndex<T extends FeatureStructure>
      extends FSLeafIndexImpl<T>

  Used for UIMA FS Bag Indexes Uses IntVector or PositiveIntSet to hold values of FSs

- - ### Field Summary

    - ### Fields inherited from class org.apache.uima.cas.impl.FSLeafIndexImpl

      `lowLevelCAS`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `bulkAddTo(org.apache.uima.internal.util.IntVector v)` For serialization: get all the items in this index and bulk add to an IntVector
    `int` | `compare(int fs1, int fs2)` For bag indexes, compare equal only if identical addresses
    `boolean` | `contains(FeatureStructure fs)`
    `void` | `deleteFS(FeatureStructure fs)` Method deleteFS.
    `FeatureStructure` | `find(FeatureStructure fs)`
    `void` | `flush()`
    `int` | `hashCode()`
    `boolean` | `insert(int fs)`
    `LowLevelIterator` | `ll_iterator()` Get a low-level, FS reference iterator.
    `org.apache.uima.internal.util.ComparableIntPointerIterator<T>` | `pointerIterator(org.apache.uima.internal.util.IntComparator comp, int[] detectIllegalIndexUpdates, int typeCode)`
    `protected org.apache.uima.internal.util.IntPointerIterator` | `refIterator()`
    `protected org.apache.uima.internal.util.IntPointerIterator` | `refIterator(int fsCode)`
    `boolean` | `remove(int fsRef)`
    `int` | `size()` Get the number of FSs in this index.

    - ### Methods inherited from class org.apache.uima.cas.impl.FSLeafIndexImpl

      `compare, equals, getComparator, getIndexingStrategy, getIntIterator, getType, iterator, ll_compare, ll_iterator, ll_rootIterator, toString`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.Comparator

      `comparing, comparing, comparingDouble, comparingInt, comparingLong, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong`

- - ### Method Detail

    - #### flush

          public void flush()

    - #### insert

          public final boolean insert(int fs)

    - #### compare

          public int compare(int fs1,
                             int fs2)

      For bag indexes, compare equal only if identical addresses
      Specified by:
        `compare` in interface `org.apache.uima.internal.util.IntComparator`
      Overrides:
        `compare` in class `FSLeafIndexImpl<T extends FeatureStructure>`
      Parameters:
        `fs1` - -
        `fs2` - -
      Returns:
        0 if equal, < 0 if fs1 < fs2, > 0 if fs1 > fs2

    - #### pointerIterator

          public org.apache.uima.internal.util.ComparableIntPointerIterator<T> pointerIterator(org.apache.uima.internal.util.IntComparator comp,
                                                                                               int[] detectIllegalIndexUpdates,
                                                                                               int typeCode)

      Specified by:
        `pointerIterator` in class `FSLeafIndexImpl<T extends FeatureStructure>`

    - #### refIterator

          protected org.apache.uima.internal.util.IntPointerIterator refIterator()

      Specified by:
        `refIterator` in class `FSLeafIndexImpl<T extends FeatureStructure>`
      See Also:
        `FSLeafIndexImpl.refIterator()`

    - #### ll_iterator

          public LowLevelIterator ll_iterator()

      Description copied from interface: `LowLevelIndex`
      Get a low-level, FS reference iterator.
      Returns:
        An iterator for this index.

    - #### refIterator

          protected org.apache.uima.internal.util.IntPointerIterator refIterator(int fsCode)

      Specified by:
        `refIterator` in class `FSLeafIndexImpl<T extends FeatureStructure>`
      See Also:
        `FSLeafIndexImpl.refIterator(int)`

    - #### contains

          public boolean contains(FeatureStructure fs)

      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:
        `FSIndex.contains(FeatureStructure)`

    - #### find

          public FeatureStructure find(FeatureStructure fs)

    - #### size

          public int size()

      Description copied from interface: `LowLevelIndex`
      Get the number of FSs in this index.
      Returns:
        The size of this index.
      See Also:
        `FSIndex.size()`

    - #### deleteFS

          public void deleteFS(FeatureStructure fs)

      Description copied from class: `FSLeafIndexImpl`
      Method deleteFS.
      Specified by:
        `deleteFS` in class `FSLeafIndexImpl<T extends FeatureStructure>`
      Parameters:
        `fs` - -
      See Also:
        `FSLeafIndexImpl.deleteFS(org.apache.uima.cas.FeatureStructure)`

    - #### remove

          public boolean remove(int fsRef)

      Parameters:
        `fsRef` - - the Feature Structure to be removed. Only this exact Feature Structure is removed (this is a stronger test than, for example, what moveTo(fs) does, where the fs in that case is used as a template). It is not an error if this exact Feature Structure is not in an index.
      Returns:
        true if something was removed, false if not found

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `FSLeafIndexImpl<T extends FeatureStructure>`

    - #### bulkAddTo

          protected void bulkAddTo(org.apache.uima.internal.util.IntVector v)

      Description copied from class: `FSLeafIndexImpl`
      For serialization: get all the items in this index and bulk add to an IntVector
      Specified by:
        `bulkAddTo` in class `FSLeafIndexImpl<T extends FeatureStructure>`
      Parameters:
        `v` - the set of items to add

Copyright © 2006–2021 The Apache Software Foundation. All rights reserved.