Package com.saxonica.ee.trans

## Class Characteristic<T>

- java.lang.Object
- - com.saxonica.ee.trans.Characteristic<T>

- Direct Known Subclasses:
    `AncestorCharacteristic`, `GeneralComparisonOperand`, `NumericComparisonOperand`, `TokenMatchOperand`

      public abstract class Characteristic<T>
      extends java.lang.Object

  A Characteristic represents a distinguishing feature of an item that may be used by several patterns in a rule chain, and which can usefully be evaluated once for all rules in the rule chain. Characteristics are evaluated in the course of evaluating preconditions, and their values may be used again when evaluating a different precondition. For example (a classic DITA use case), the tokenized value of an element's `@class` attribute is a characteristic that may be used by several preconditions that test for the presence of particular tokens in the value.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Characteristic()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `abstract T` | `evaluate​(XPathContext context)` | Evaluate the value of this characteristic for the context item
    `int` | `getSlotNumber()` | Get the slot number allocated to the value of this characteristic in the `RuleSearchState`
    `void` | `setSlotNumber​(int slotNumber)` | Allocate a slot number to this characteristic in the `RuleSearchState`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Characteristic

          public Characteristic()

  - ### Method Detail

    - #### getSlotNumber

          public final int getSlotNumber()

      Get the slot number allocated to the value of this characteristic in the `RuleSearchState`
      Returns:
        the allocated slot number

    - #### setSlotNumber

          public final void setSlotNumber​(int slotNumber)

      Allocate a slot number to this characteristic in the `RuleSearchState`
      Parameters:
        `slotNumber` - the slot number to be allocated

    - #### evaluate

          public abstract T evaluate​(XPathContext context)
                              throws XPathException

      Evaluate the value of this characteristic for the context item
      Parameters:
        `context` - the dynamic evaluation context; the context item is the item being matched
      Returns:
        the value of the characteristic
      Throws:
        `XPathException` - if evaluation of the characteristic fails