Class 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 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
        the allocated slot number
      • setSlotNumber

        public final void setSlotNumber​(int slotNumber)
        Allocate a slot number to this characteristic in the RuleSearchState
        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
        context - the dynamic evaluation context; the context item is the item being matched
        the value of the characteristic
        XPathException - if evaluation of the characteristic fails