org.apache.uima.cas.admin

## Interface FSIndexComparator

- All Superinterfaces:
    Comparable<FSIndexComparator>
  All Known Implementing Classes:
    FSIndexComparatorImpl

      public interface FSIndexComparator
      extends Comparable<FSIndexComparator>

  Interface for creating comparators, which in turn are used to create indexes.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `FEATURE_KEY`
    `static int` | `REVERSE_STANDARD_COMPARE` Compare key1 of fs1 with key2 of fs2 so that the order of fs1 and fs2 is the reverse as that of key1 and key2 (with respect to the standard order of that key).
    `static int` | `STANDARD_COMPARE` Compare key1 of fs1 with key2 of fs2 so that the order of fs1 and fs2 is the same as that of key1 and key2 in the standard order for that kind of key.
    `static int` | `TYPE_ORDER_KEY`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `addKey(Feature feat, int compareKey)` Add a new key.
    `int` | `addKey(LinearTypeOrder typeOrder, int compareKey)`
    `boolean` | `equals(Object o)` Test for equality against another `FSIndexComparator` `true` iff the comparators have the same keys and comparators.
    `int` | `getKeyComparator(int key)` Get the comparator for this key.
    `Feature` | `getKeyFeature(int key)` Get the feature for this key.
    `int` | `getKeyType(int key)`
    `int` | `getNumberOfKeys()` Return the number of keys.
    `Type` | `getType()` Get the type of this comparator.
    `boolean` | `isValid()` Validate that this comparator is valid with respect to the type system.
    `void` | `setType(Type type)` Set the type of this comparator.

    - ### Methods inherited from interface java.lang.Comparable

      `compareTo`

- - ### Field Detail

    - #### FEATURE_KEY

          static final int FEATURE_KEY

      See Also:
        Constant Field Values

    - #### TYPE_ORDER_KEY

          static final int TYPE_ORDER_KEY

      See Also:
        Constant Field Values

    - #### STANDARD_COMPARE

          static final int STANDARD_COMPARE

      Compare key1 of fs1 with key2 of fs2 so that the order of fs1 and fs2 is the same as that of key1 and key2 in the standard order for that kind of key. For integer and float values, this is the standard linear order, and for strings it is lexicographic order.
      See Also:
        Constant Field Values

    - #### REVERSE_STANDARD_COMPARE

          static final int REVERSE_STANDARD_COMPARE

      Compare key1 of fs1 with key2 of fs2 so that the order of fs1 and fs2 is the reverse as that of key1 and key2 (with respect to the standard order of that key).
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### setType

          void setType(Type type)

      Set the type of this comparator. Note that you can use this method more than once, in case you need to generate indexes that are identical except for the type.
      Parameters:
        `type` - The type of the index.

    - #### getType

          Type getType()

      Get the type of this comparator.
      Returns:
        The type of the comparator.

    - #### addKey

          int addKey(Feature feat,
                     int compareKey)

      Add a new key.
      Parameters:
        `feat` - The key feature.
        `compareKey` - The way to compare the key values.
      Returns:
        The number of the key.

    - #### addKey

          int addKey(LinearTypeOrder typeOrder,
                     int compareKey)

    - #### getNumberOfKeys

          int getNumberOfKeys()

      Return the number of keys.
      Returns:
        the number of keys.

    - #### getKeyType

          int getKeyType(int key)

    - #### getKeyFeature

          Feature getKeyFeature(int key)

      Get the feature for this key.
      Parameters:
        `key` - The number of the key.
      Returns:
        The corresponding feature, if it exists; `null`, else.

    - #### getKeyComparator

          int getKeyComparator(int key)

      Get the comparator for this key.
      Parameters:
        `key` - The number of the key.
      Returns:
        The corresponding comparator, if it exists; `-1`, else.

    - #### equals

          boolean equals(Object o)

      Test for equality against another `FSIndexComparator` `true` iff the comparators have the same keys and comparators.
      Overrides:
        `equals` in class `Object`

    - #### isValid

          boolean isValid()

      Validate that this comparator is valid with respect to the type system. Note that all types and features used to define this comparator must come from the same type system. Note that this method only returns true or false. It doesn't tell you what's actually wrong. Maybe we need to change that?
      Returns:
        `true` iff all key features are appropriate for the type of this comparator.

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