Package com.saxonica.ee.trans

## Class TemplateRuleEE

- java.lang.Object
- - net.sf.saxon.expr.instruct.TemplateRule
  - - com.saxonica.ee.trans.TemplateRuleEE

- All Implemented Interfaces:
    `javax.xml.transform.SourceLocator`, `ExpressionOwner`, `Locatable`, `Location`, `Traceable`, `TraceableComponent`, `RuleTarget`, `org.xml.sax.Locator`

      public class TemplateRuleEE
      extends TemplateRule

  Saxon-EE version of the TemplateRule class, with added code for JIT compilation and streamability analysis

- - ### Field Summary

    - ### Fields inherited from class net.sf.saxon.expr.instruct.TemplateRule

      `body, matchPattern, slaveCopies`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `TemplateRuleEE()` | Create a template rule

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `TemplateRule` | `copy()` | Create a copy of a template rule.
    `TemplateRuleInitializer` | `getInitializer()` |
    `ComponentInversion` | `getInversion()` |
    `void` | `initialize()` | Ensure that any first-time initialization has been done.
    `boolean` | `isActuallyStreamable​(java.util.List<java.lang.String> reasons)` | Ask whether this template satisfies the rules for a guaranteed streamable template
    `boolean` | `isDeclaredStreamable()` | Ask whether or not this template is declared as streamable
    `void` | `makeInversion()` | Generate the inversion of the expression comprising the body of a template rules.
    `void` | `prepareInitializer​(Compilation compilation, ComponentDeclaration decl, StructuredQName modeName)` | Prepare for JIT compilation.
    `void` | `setDeclaredStreamable​(boolean streamable)` | Say whether or not this template is declared as streamable
    `void` | `setInitializer​(TemplateRuleInitializer initializer)` |

    - ### Methods inherited from class net.sf.saxon.expr.instruct.TemplateRule

      `apply, applyLeavingTail, copyTo, explainProperties, export, gatherProperties, getBody, getChildExpression, getColumnNumber, getComponentKind, getContainerGranularity, getInterpretedBody, getLineNumber, getLocalParams, getLocation, getMatchPattern, getObjectName, getPackageData, getPublicId, getRequiredContextItemType, getRequiredType, getRules, getStackFrameMap, getSystemId, getTracingTag, hasRequiredParams, isAbsentFocus, registerRule, saveLocation, setBody, setChildExpression, setColumnNumber, setContextItemRequirements, setHasRequiredParams, setLineNumber, setMatchPattern, setPackageData, setRequiredType, setStackFrameMap, setSystemId, updateSlaveCopies`

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

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

- - ### Constructor Detail

    - #### TemplateRuleEE

          public TemplateRuleEE()

      Create a template rule

  - ### Method Detail

    - #### setDeclaredStreamable

          public void setDeclaredStreamable​(boolean streamable)

      Say whether or not this template is declared as streamable
      Overrides:
        `setDeclaredStreamable` in class `TemplateRule`
      Parameters:
        `streamable` - true if the template belongs to a streamable mode; set to false if it does not belong to a streamable mode, or if it is found that the template is not actually streamable, and fallback to non-streaming has been requested.

    - #### isDeclaredStreamable

          public boolean isDeclaredStreamable()

      Ask whether or not this template is declared as streamable
      Overrides:
        `isDeclaredStreamable` in class `TemplateRule`
      Returns:
        true if the template belongs to a streamable mode; false if it does not belong to a streamable mode, or if it is found that the template is not actually streamable, and fallback to non-streaming has been requested.

    - #### setInitializer

          public void setInitializer​(TemplateRuleInitializer initializer)

    - #### getInitializer

          public TemplateRuleInitializer getInitializer()

    - #### prepareInitializer

          public void prepareInitializer​(Compilation compilation,
                                         ComponentDeclaration decl,
                                         StructuredQName modeName)

      Prepare for JIT compilation.
      Overrides:
        `prepareInitializer` in class `TemplateRule`
      Parameters:
        `compilation` - the XSLT compilation
        `decl` - the component declaration of this template rule

    - #### initialize

          public void initialize()
                          throws XPathException

      Ensure that any first-time initialization has been done. Used in Saxon-EE to do JIT compilation
      Overrides:
        `initialize` in class `TemplateRule`
      Throws:
        `XPathException`

    - #### copy

          public TemplateRule copy()

      Create a copy of a template rule. This is needed when copying a rule from the "omniMode" (mode=#all) to a specific mode. Because we want the rules to be chained in the right order within the mode object, we create the copy as soon as we know it is needed. The problem is that at this stage many of the properties of the template rule are still uninitialised. So we mark the new copy as a slave of the original, and at the end of the compilation process we update all the slave copies to match the properties of the original.
      Overrides:
        `copy` in class `TemplateRule`

    - #### isActuallyStreamable

          public boolean isActuallyStreamable​(java.util.List<java.lang.String> reasons)

      Ask whether this template satisfies the rules for a guaranteed streamable template
      Parameters:
        `reasons` - the caller may supply a list which on return will contain explanations for why the template is not streamable, suitable for inclusion in error messages
      Returns:
        true if the template is within the (Saxon or W3C) definition of guaranteed streamable

    - #### makeInversion

          public void makeInversion()
                             throws XPathException

      Generate the inversion of the expression comprising the body of a template rules. Supported in Saxon-EE only
      Throws:
        `XPathException`

    - #### getInversion

          public ComponentInversion getInversion()
                                          throws XPathException

      Throws:
        `XPathException`