Class Characteristic

  • Direct Known Subclasses:
    AncestorCharacteristic, GeneralComparisonOperand, NumericComparisonOperand, TokenMatchOperand

    public abstract class Characteristic
    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
        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 java.lang.Object 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