Package org.apache.uima.cas

# Interface FeatureStructure

All Superinterfaces:
  `Cloneable`

All Known Subinterfaces:
  `AnnotationBaseFS`, `AnnotationBaseImpl`, `AnnotationFS`, `AnnotationImpl`, `ArrayFS<E>`, `ArrayFSImpl<E>`, `BooleanArrayFS`, `BooleanArrayFSImpl`, `ByteArrayFS`, `ByteArrayFSImpl`, `CommonArrayFS<E>`, `CommonArrayFSImpl`, `CommonList`, `CommonPrimitiveArray<T>`, `DoubleArrayFS`, `DoubleArrayFSImpl`, `EmptyList`, `FeatureStructureImpl`, `FloatArrayFS`, `FloatArrayFSImpl`, `IntArrayFS`, `IntArrayFSImpl`, `LongArrayFS`, `LongArrayFSImpl`, `NonEmptyList`, `ShortArrayFS`, `ShortArrayFSImpl`, `SofaFS`, `SofaFSImpl`, `StringArrayFS`, `StringArrayFSImpl`

All Known Implementing Classes:
  `Annotation`, `AnnotationBase`, `BooleanArray`, `ByteArray`, `DocumentAnnotation`, `DoubleArray`, `EmptyFloatList`, `EmptyFSList`, `EmptyIntegerList`, `EmptyStringList`, `FeatureStructureImplC`, `FloatArray`, `FloatList`, `FSArray`, `FSArrayList`, `FSHashSet`, `FSLinkedHashSet`, `FSList`, `Int2FS`, `IntegerArray`, `IntegerArrayList`, `IntegerList`, `LongArray`, `NonEmptyFloatList`, `NonEmptyFSList`, `NonEmptyIntegerList`, `NonEmptyStringList`, `ShortArray`, `Sofa`, `SourceDocumentInformation`, `StringArray`, `StringList`, `TOP`

public interface FeatureStructure extends Cloneable
Interface for feature structures. This interface includes indirect getters and setters that use Feature object instances to specify the feature. There are multiple versions of these, corresponding to the consolidated types of the feature range. Here are the types: FeatureStructure - reference to another Feature structure String float int byte boolean short long double

- ## Method Summary

  Modifier and Type
  Method
  Description
  `int`
  `_getTypeCode()`
  Internal use
  `int`
  `_id()`
  return the unique (to this CAS) id of this feature structure
  `Object`
  `clone()`
  Creates a copy of this feature structure.
  `boolean`
  `equals(Object o)`
  A feature structure is equal to another feature structure iff it is identical in the underlying representation.
  `int`
  `getAddress()`
  Compatibility for v2 code.
  `boolean`
  `getBooleanValue(Feature feat)`
  Get the boolean value of a feature.
  `byte`
  `getByteValue(Feature feat)`
  Get the byte value of a feature.
  `CAS`
  `getCAS()`
  `double`
  `getDoubleValue(Feature feat)`
  Get the double value of a feature.
  `FeatureStructure`
  `getFeatureValue(Feature feat)`
  Get a feature value.
  `String`
  `getFeatureValueAsString(Feature feat)`
  Get the value of the feature as a string if the type of the feature is one of the primitive type.
  `float`
  `getFloatValue(Feature feat)`
  Get the float value of a feature.
  `int`
  `getIntValue(Feature feat)`
  Get the int value of a feature.
  `default JCas`
  `getJCas()`
  `long`
  `getLongValue(Feature feat)`
  Get the long value of a feature.
  `short`
  `getShortValue(Feature feat)`
  Get the short value of a feature.
  `String`
  `getStringValue(Feature f)`
  Get the string value under a feature.
  `Type`
  `getType()`
  Get the type of this FS.
  `int`
  `hashCode()`
  Will return a hash code that's consistent with equality, i.e., if two FSs are equal, they will also return the same hash code.
  `void`
  `setBooleanValue(Feature feat, boolean i)`
  Set the boolean value of a feature.
  `void`
  `setByteValue(Feature feat, byte i)`
  Set the byte (8 bit) value of a feature.
  `void`
  `setDoubleValue(Feature feat, double i)`
  Set the double value of a feature.
  `void`
  `setFeatureValue(Feature feat, FeatureStructure fs)`
  Set a feature value to another FS.
  `void`
  `setFeatureValueFromString(Feature feat, String s)`
  Sets the value of a feature from a string input if the feature type is one of the primitive types.
  `void`
  `setFloatValue(Feature feat, float f)`
  Set the float value of a feature.
  `void`
  `setIntValue(Feature feat, int i)`
  Set the int value of a feature.
  `void`
  `setLongValue(Feature feat, long i)`
  Set the long (64 bit) value of a feature.
  `void`
  `setShortValue(Feature feat, short i)`
  Set the short (16 bit) value of a feature.
  `void`
  `setStringValue(Feature feat, String s)`
  Set the string value of a feature.

- ## Method Details

  - ### getType

    Type getType()
    Get the type of this FS.
    Returns:
      The type.

  - ### setFeatureValue

    void setFeatureValue(Feature feat, FeatureStructure fs) throws CASRuntimeException
    Set a feature value to another FS.
    Parameters:
      `feat` - The feature whose value should be set.
      `fs` - The value FS.
    Throws:
      `CASRuntimeException` - If there is a typing violation, i.e., if `feat` is not defined for the type of this FS, or the range type of `feat` is not a supertype of `fs.getType()`.

  - ### getFeatureValue

    FeatureStructure getFeatureValue(Feature feat) throws CASRuntimeException
    Get a feature value.
    Parameters:
      `feat` - The feature whose value we want to get.
    Returns:
      The value; may be `null` if the value has not been set.
    Throws:
      `CASRuntimeException` - If there is a typing violation, i.e., if `feat` is not defined for the type of this FS, or the range type of `feat` is Float, Integer or String.

  - ### setStringValue

    void setStringValue(Feature feat, String s) throws CASRuntimeException
    Set the string value of a feature.
    Parameters:
      `feat` - The feature whose value we want to set.
      `s` - The string we're setting the feature to.
    Throws:
      `CASRuntimeException` - If there is a typing violation, i.e., if `feat` is not defined for `this.getType()` or `feat.getRange()` is not `CAS.STRING_TYPE`.

  - ### getStringValue

    String getStringValue(Feature f) throws CASRuntimeException
    Get the string value under a feature.
    Parameters:
      `f` - The feature for which we want the value.
    Returns:
      The value of this feature; may be `null` if the value has not been set.
    Throws:
      `CASRuntimeException` - If there is a typing violation, i.e., if `f` is not defined for the type of this feature structure, or if the range type of `f` is not String.

  - ### getFloatValue

    float getFloatValue(Feature feat) throws CASRuntimeException
    Get the float value of a feature. This method will throw an exception if the feature is not float valued.
    Parameters:
      `feat` - The feature whose value we want to get.
    Returns:
      The value float; `0.0` if the value has not been set.
    Throws:
      `CASRuntimeException` - If `feat` is not defined for the type of this FS, or if it is not float valued.

  - ### setFloatValue

    void setFloatValue(Feature feat, float f) throws CASRuntimeException
    Set the float value of a feature.
    Parameters:
      `feat` - The feature whose value we want to set.
      `f` - The float we're setting the feature to.
    Throws:
      `CASRuntimeException` - If `feat` is not defined for the type of this FS, or if it is not float valued.

  - ### getIntValue

    int getIntValue(Feature feat) throws CASRuntimeException
    Get the int value of a feature. This method will throw an exception if the feature is not int valued.
    Parameters:
      `feat` - The feature whose value we want to get.
    Returns:
      The value int; `0` if the value has not been set.
    Throws:
      `CASRuntimeException` - If `feat` is not defined for the type of this FS, or if it is not int valued.

  - ### setIntValue

    void setIntValue(Feature feat, int i) throws CASRuntimeException
    Set the int value of a feature.
    Parameters:
      `feat` - The feature whose value we want to set.
      `i` - The int we're setting the feature to.
    Throws:
      `CASRuntimeException`

  - ### getByteValue

    byte getByteValue(Feature feat) throws CASRuntimeException
    Get the byte value of a feature. This method will throw an exception if the feature is not byte valued.
    Parameters:
      `feat` - The feature whose value we want to set.
    Returns:
      The value byte; `0` if the value has not been set.
    Throws:
      `CASRuntimeException` - tbd

  - ### setByteValue

    void setByteValue(Feature feat, byte i) throws CASRuntimeException
    Set the byte (8 bit) value of a feature.
    Parameters:
      `feat` - The feature whose value we want to set.
      `i` - The 8bit value we're setting the feature to.
    Throws:
      `CASRuntimeException` - tbd

  - ### getBooleanValue

    boolean getBooleanValue(Feature feat) throws CASRuntimeException
    Get the boolean value of a feature. This method will throw an exception if the feature is not boolean valued.
    Parameters:
      `feat` - The feature whose value we want to get.
    Returns:
      The value int; `0` if the value has not been set.
    Throws:
      `CASRuntimeException` - If `feat` is not defined for the type of this FS, or if it is not boolean valued.

  - ### setBooleanValue

    void setBooleanValue(Feature feat, boolean i) throws CASRuntimeException
    Set the boolean value of a feature.
    Parameters:
      `feat` - The feature whose value we want to set.
      `i` - The boolean value we're setting the feature to.
    Throws:
      `CASRuntimeException`

  - ### getShortValue

    short getShortValue(Feature feat) throws CASRuntimeException
    Get the short value of a feature. This method will throw an exception if the feature is not short valued.
    Parameters:
      `feat` - The feature whose value we want to get.
    Returns:
      The value int; `0` if the value has not been set.
    Throws:
      `CASRuntimeException` - If `feat` is not defined for the type of this FS, or if it is not short valued.

  - ### setShortValue

    void setShortValue(Feature feat, short i) throws CASRuntimeException
    Set the short (16 bit) value of a feature.
    Parameters:
      `feat` - The feature whose value we want to set.
      `i` - The short (16bit) value we're setting the feature to.
    Throws:
      `CASRuntimeException`

  - ### getLongValue

    long getLongValue(Feature feat) throws CASRuntimeException
    Get the long value of a feature. This method will throw an exception if the feature is not long valued.
    Parameters:
      `feat` - The feature whose value we want to get.
    Returns:
      The value int; `0` if the value has not been set.
    Throws:
      `CASRuntimeException` - If `feat` is not defined for the type of this FS, or if it is not long valued.

  - ### setLongValue

    void setLongValue(Feature feat, long i) throws CASRuntimeException
    Set the long (64 bit) value of a feature.
    Parameters:
      `feat` - The feature whose value we want to set.
      `i` - The long (64bit) value we're setting the feature to.
    Throws:
      `CASRuntimeException`

  - ### getDoubleValue

    double getDoubleValue(Feature feat) throws CASRuntimeException
    Get the double value of a feature. This method will throw an exception if the feature is not double valued.
    Parameters:
      `feat` - The feature whose value we want to get.
    Returns:
      The value int; `0` if the value has not been set.
    Throws:
      `CASRuntimeException` - If `feat` is not defined for the type of this FS, or if it is not double valued.

  - ### setDoubleValue

    void setDoubleValue(Feature feat, double i) throws CASRuntimeException
    Set the double value of a feature.
    Parameters:
      `feat` - The feature whose value we want to set.
      `i` - The double value we're setting the feature to.
    Throws:
      `CASRuntimeException` - If `feat` is not defined for the type of this FS

  - ### getFeatureValueAsString

    String getFeatureValueAsString(Feature feat) throws CASRuntimeException
    Get the value of the feature as a string if the type of the feature is one of the primitive type.
    Parameters:
      `feat` - The feature whose value we want to get and whose type is one of the primitive types.
    Returns:
      A string representation of the feature value.
    Throws:
      `CASRuntimeException` - If `feat` is not defined for the type of this FS, or if the type is not a primitive type.

  - ### setFeatureValueFromString

    void setFeatureValueFromString(Feature feat, String s) throws CASRuntimeException
    Sets the value of a feature from a string input if the feature type is one of the primitive types.
    Parameters:
      `feat` - The feature whose value we want to set.
      `s` - The string value that the feature will be set to.
    Throws:
      `CASRuntimeException` - If `feat` is not a primitive type or the value cannot be converted to this type.

  - ### getCAS

    CAS getCAS()
    Returns:
      The CAS view where this Feature Structure was created

  - ### getJCas

    default JCas getJCas()
    Returns:
      the JCas view where this Feature Structure was created

  - ### _id

    int _id()
    return the unique (to this CAS) id of this feature structure
    Returns:
      the id

  - ### _getTypeCode

    int _getTypeCode()
    Internal use
    Returns:
      the type code of this feature structure

  - ### clone

    Object clone() throws CASRuntimeException
    Creates a copy of this feature structure. The returned feature structure is a new and separate object but all features of the feature structure which are not of builtin types (integer, float, string) will be shared between the clone and it's source FS.
    Returns:
      a FeatureStructure that is the cloned copy of this FeatureStructure.
    Throws:
      `CASRuntimeException` - passthru

  - ### getAddress

    int getAddress()
    Compatibility for v2 code. As a side effect, this will enter this Feature Structure into the int-to-FS table so the low level API call ll_getFSForRef(int) works. This has the effect of disabling garbage collection for this Feature Structure.
    Returns:
      the equivalent of the v2 address

  - ### equals

    boolean equals(Object o) throws ClassCastException
    A feature structure is equal to another feature structure iff it is identical in the underlying representation.
    Overrides:
      `equals` in class `Object`
    Throws:
      `ClassCastException` - If `o` is not a FS.

  - ### hashCode

    int hashCode()
    Will return a hash code that's consistent with equality, i.e., if two FSs are equal, they will also return the same hash code.
    Overrides:
      `hashCode` in class `Object`
    Returns:
      The hash code.