Package com.saxonica.ee.trans

## Class GeneralPatternOptimizer

- java.lang.Object
- - com.saxonica.ee.trans.PatternOptimizer
  - - com.saxonica.ee.trans.GeneralPatternOptimizer

-     public class GeneralPatternOptimizer
      extends PatternOptimizer

  A PatternOptimizer is an agent responsible for optimizing a particular class of patterns. The `GeneralPatternOptimizer` is an umbrella implementation that delegates to a number of more specific pattern optimizers.

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `appliesTo​(Pattern pattern)` | Ask whether this pattern optimizer is applicable to a particular pattern
    `static GeneralPatternOptimizer` | `getInstance()` |
    `void` | `process​(RuleEE rule, Pattern pattern, java.util.Map<Precondition,​java.util.List<RuleEE>> preconditions, java.util.Map<Characteristic,​Characteristic> characteristics)` | Process a particular pattern, potentially adding to the list of preconditions and characteristics maintained when processing a set of rules

    - ### Methods inherited from class com.saxonica.ee.trans.PatternOptimizer

      `addPrecondition, allocateCharacteristic`

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

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

- - ### Constructor Detail

    - #### GeneralPatternOptimizer

          public GeneralPatternOptimizer()

  - ### Method Detail

    - #### getInstance

          public static GeneralPatternOptimizer getInstance()

    - #### appliesTo

          public boolean appliesTo​(Pattern pattern)

      Description copied from class: `PatternOptimizer`
      Ask whether this pattern optimizer is applicable to a particular pattern
      Specified by:
        `appliesTo` in class `PatternOptimizer`
      Parameters:
        `pattern` - the pattern in question
      Returns:
        true if this pattern optimizer is applicable to this pattern

    - #### process

          public void process​(RuleEE rule,
                              Pattern pattern,
                              java.util.Map<Precondition,​java.util.List<RuleEE>> preconditions,
                              java.util.Map<Characteristic,​Characteristic> characteristics)

      Description copied from class: `PatternOptimizer`
      Process a particular pattern, potentially adding to the list of preconditions and characteristics maintained when processing a set of rules
      Specified by:
        `process` in class `PatternOptimizer`
      Parameters:
        `rule` - the rule to be processed
        `pattern` - the pattern used by this rule
        `preconditions` - a collection of preconditions maintained for a set of rules
        `characteristics` - a collection of characteristics maintained for a set of rules. This is maintained as a map from characteristics to characteristics in which the key and the value are always the same; the reason for this curious structure is that when an equivalent characteristic is already present in the map, we want to return the existing characteristic to replace the new one; a Java `Set` does not have any (efficient) operation to "find the existing value in the set that is equal to X".