org.apache.uima.cas

## Interface FSIndexRepository

- All Known Subinterfaces:
    FSIndexRepositoryMgr

      public interface FSIndexRepository

  Repository of indexes over feature structures. Use this interface to access previously defined indexes. Generics: T is the associated Java cover class for the top type defined for this index name. If JCas is being used, it is that JCas class. Otherwise it is the standard non-JCas Java cover class.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addFS(FeatureStructure fs)` Add a feature structure to all appropriate indexes in the repository.
    `<T extends FeatureStructure> FSIterator<T>` | `getAllIndexedFS(Type aType)` Gets an iterator over all indexed FeatureStructures of the specified Type (and any of its subtypes).
    `<T extends FeatureStructure> FSIndex<T>` | `getIndex(String label)` Retrieve an index according to a label.
    `<T extends FeatureStructure> FSIndex<T>` | `getIndex(String label, Type type)` Retrieve an index according to a label and a type.
    `Iterator<FSIndex<FeatureStructure>>` | `getIndexes()` Get all indexes in this repository.
    `Iterator<String>` | `getLabels()` Get all labels for all indexes.
    `Iterator<org.apache.uima.cas.impl.LowLevelIndex>` | `ll_getIndexes()` Get all indexes in this repository as low level indexes
    `void` | `removeAllExcludingSubtypes(Type type)` Remove all instances of just this type, excluding subtypes, from all indexes in the repository view.
    `void` | `removeAllIncludingSubtypes(Type type)` Remove all instances of type, including all subtypes from all indexes in the repository view.
    `void` | `removeFS(FeatureStructure fs)` Remove a feature structure from all indexes in the repository.

- - ### Method Detail

    - #### getIndex

          <T extends FeatureStructure> FSIndex<T> getIndex(String label)

      Retrieve an index according to a label. Generics: T is the associated Java cover class for the top type defined for this index name.
      Type Parameters:
        `T` - the Java class associated with the top-most type of the index
      Parameters:
        `label` - The name of the index.
      Returns:
        The index with the name `label`, or `null` if no such index is defined.

    - #### getIndex

          <T extends FeatureStructure> FSIndex<T> getIndex(String label,
                                                           Type type)
                                                    throws CASRuntimeException

      Retrieve an index according to a label and a type. The type is used to narrow down the index of a more general type to a more specific one. Generics: T is the associated Java cover class for the type.
      Type Parameters:
        `T` - The Java class associated with the type
      Parameters:
        `label` - The name of the index.
        `type` - A subtype of the type of the index.
      Returns:
        The specified, or `null` if an index with that name doesn't exist.
      Throws:
        `CASRuntimeException` - When `type` is not a subtype of the index's type.

    - #### getLabels

          Iterator<String> getLabels()

      Get all labels for all indexes.
      Returns:
        All labels.

    - #### getIndexes

          Iterator<FSIndex<FeatureStructure>> getIndexes()

      Get all indexes in this repository.
      Returns:
        All indexes.

    - #### ll_getIndexes

          Iterator<org.apache.uima.cas.impl.LowLevelIndex> ll_getIndexes()

      Get all indexes in this repository as low level indexes
      Returns:
        All indexes.

    - #### addFS

          void addFS(FeatureStructure fs)

      Add a feature structure to all appropriate indexes in the repository. If no indexes exist for the type of FS that you are adding, then a bag (unsorted) index will be automatically created.

      Important: after you have called `addFS()` on a FS, do not change the values of any features used for indexing. If you do, the index will become corrupted and may be unusable. If you need to change an index feature value, first call `removeFS()` on the FS, change the feature values, then call `addFS()` again.

      Parameters:
        `fs` - The FS to be added.
      Throws:
        `NullPointerException` - If the `fs` parameter is `null`.

    - #### removeFS

          void removeFS(FeatureStructure fs)

      Remove a feature structure from all indexes in the repository.
      Parameters:
        `fs` - The FS to be removed.
      Throws:
        `NullPointerException` - If the `fs` parameter is `null`.

    - #### removeAllIncludingSubtypes

          void removeAllIncludingSubtypes(Type type)

      Remove all instances of type, including all subtypes from all indexes in the repository view.
      Parameters:
        `type` - the type to remove
      Throws:
        `NullPointerException` - if the `type` parameter is `null`.

    - #### removeAllExcludingSubtypes

          void removeAllExcludingSubtypes(Type type)

      Remove all instances of just this type, excluding subtypes, from all indexes in the repository view.
      Parameters:
        `type` - the type to remove
      Throws:
        `NullPointerException` - if the `type` parameter is `null`.

    - #### getAllIndexedFS

          <T extends FeatureStructure> FSIterator<T> getAllIndexedFS(Type aType)

      Gets an iterator over all indexed FeatureStructures of the specified Type (and any of its subtypes). The elements are returned in arbitrary order, and duplicates (if they exist) are not removed. Generics: T is the Java class for aType.
      Type Parameters:
        `T` - The Java class associated with aType
      Parameters:
        `aType` - The type
      Returns:
        An iterator that returns all indexed FeatureStructures of type `aType` and its subtypes, in no particular order.

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