org.apache.uima.cas_data

## Interface FeatureStructure

- All Superinterfaces:
    Serializable
  All Known Subinterfaces:
    PrimitiveArrayFS, ReferenceArrayFS
  All Known Implementing Classes:
    FeatureStructureImpl, PrimitiveArrayFSImpl, ReferenceArrayFSImpl

      public interface FeatureStructure
      extends Serializable

  An object in the CAS. Each FeatureStructure has an optional ID, a type (represented as a string), and a collection of features, which are attribute-value pairs. Feature names are strings, and their values may be primitives (String, integer, float) or references (via ID) to another FeatureStructures. Circular references are allowed.

  Arrays are represented by the subtypes `PrimitiveArrayFS` and `ReferenceArrayFS`. Arrays are not primitive values. This means that if the value of a feature is conceptually, for example, an integer array, this will be represented in the CasData as a reference, via ID, to a PrimitiveArrayFS object that actually contains the integer array value.

  FeatureStructures also have a property `indexed`, which determines whether the FeatureStructure should be added to the CAS's indexes if the CAS Data is converted to a CAS Object. The CasData itself does not provide indexes.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `String[]` | `getFeatureNames()` Gets the names of all features on this FeatureStructure.
    `FeatureValue` | `getFeatureValue(String aName)` Gets the value of a feature
    `String` | `getId()` Gets the ID of this FeatureStructure.
    `int[]` | `getIndexed()` Gets the index repositories that this FeatureStrucutre should be indexed in if the CasData is converted to a CAS Object.
    `String` | `getType()` Gets the type of this FeatureStructure
    `boolean` | `isIndexed()` Deprecated. Use `getIndexed()` instead
    `void` | `setFeatureValue(String aName, FeatureValue aValue)` Sets the value of a feature
    `void` | `setId(String aId)` Sets the ID of this FeatureStructure.
    `void` | `setIndexed(boolean aIndexed)` Deprecated. Use `setIndexed(int[])` instead
    `void` | `setIndexed(int[] aIndexed)` Sets the index repositories that this FeatureStrucutre should be indexed in if the CasData is converted to a CAS Object.
    `void` | `setType(String aType)` Sets the type of this FeatureStructure

- - ### Method Detail

    - #### getId

          String getId()

      Gets the ID of this FeatureStructure. IDs are optional, so this may return null. A FeatureStructure must have an ID if it is to be the target of a reference.
      Returns:
        this FeatureStructure's ID, null if none

    - #### setId

          void setId(String aId)

      Sets the ID of this FeatureStructure. IDs are optional, so null may be passed to this method. A FeatureStructure must have an ID if it is to be the target of a reference.
      Parameters:
        `aId` - the ID to assign to this FeatureStructure, null if none. It is the caller's responsibiltiy to ensure that this ID is unique within the CasData containing this FeatureStructure.

    - #### getType

          String getType()

      Gets the type of this FeatureStructure
      Returns:
        this FeatureStructure's type, as a string

    - #### setType

          void setType(String aType)

      Sets the type of this FeatureStructure
      Parameters:
        `aType` - this FeatureStructure's type, as a string

    - #### getFeatureNames

          String[] getFeatureNames()

      Gets the names of all features on this FeatureStructure.
      Returns:
        an array of feature names

    - #### getFeatureValue

          FeatureValue getFeatureValue(String aName)

      Gets the value of a feature
      Parameters:
        `aName` - name of feature
      Returns:
        value of feature named `aName`, or null if there is no such feature

    - #### setFeatureValue

          void setFeatureValue(String aName,
                               FeatureValue aValue)

      Sets the value of a feature
      Parameters:
        `aName` - name of feature to set
        `aValue` - value of feature

    - #### isIndexed

          @Deprecated
          boolean isIndexed()

      Deprecated. Use `getIndexed()` instead
      Gets whether this FeatureStructure should be indexed if the CasData is converted to a CAS Object. The CasData itself does not provide indexes.
      Returns:
        true if this FS should be indexed, false if not

    - #### setIndexed

          @Deprecated
          void setIndexed(boolean aIndexed)

      Deprecated. Use `setIndexed(int[])` instead
      Sets whether this FeatureStructure should be indexed if the CasData is converted to a CAS Object. The CasData itself does not provide indexes.
      Parameters:
        `aIndexed` - true if this FS should be indexed, false if not

    - #### getIndexed

          int[] getIndexed()

      Gets the index repositories that this FeatureStrucutre should be indexed in if the CasData is converted to a CAS Object. The CasData itself does not provide indexes.
      Returns:
        an array containing the numbers of the index repsositories that should contain this FS. Returns an empty array if this FS is not indexed.

    - #### setIndexed

          void setIndexed(int[] aIndexed)

      Sets the index repositories that this FeatureStrucutre should be indexed in if the CasData is converted to a CAS Object. The CasData itself does not provide indexes.
      Parameters:
        `aIndexed` - an array containing the numbers of the index repsositories that should contain this FS. Passing null is equivalent to passing an empty array.

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