Package net.sf.saxon.expr.parser

## Class LoopLifter

- java.lang.Object
- - net.sf.saxon.expr.parser.LoopLifter

-     public class LoopLifter
      extends java.lang.Object

  Class to handle loop-lifting optimization, that is, extraction of subexpressions appearing within a loop when there is no dependency on the controlling variable of the loop. This handles both focus-dependent loops (such as xsl:for-each) and variable-dependent loops (such as XPath for-expressions), and also takes into account specialist loops such as xsl:for-each-group, xsl:merge, and xsl:analyze-string. The class is instantiated to perform optimization of a component such as a function or template, and it contains temporary instance-level data pertaining to that function or template.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `LoopLifter​(Expression root, Configuration config, boolean streaming)` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `gatherInfo​(Expression exp)` | Gather information about an expression.
    `Expression` | `getRoot()` |
    `static Expression` | `process​(Expression exp, ExpressionVisitor visitor, ContextItemStaticInfo contextInfo)` | Apply loop-lifting to an expression (typically the body of a template or function)

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

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

- - ### Constructor Detail

    - #### LoopLifter

          public LoopLifter​(Expression root,
                            Configuration config,
                            boolean streaming)

  - ### Method Detail

    - #### process

          public static Expression process​(Expression exp,
                                           ExpressionVisitor visitor,
                                           ContextItemStaticInfo contextInfo)
                                    throws XPathException

      Apply loop-lifting to an expression (typically the body of a template or function)
      Parameters:
        `exp` - the expression to which loop lifting is applied
      Returns:
        the optimized expression
      Throws:
        `XPathException`

    - #### getRoot

          public Expression getRoot()

    - #### gatherInfo

          public void gatherInfo​(Expression exp)

      Gather information about an expression. The information (in the form of an ExpInfo object) is added to the expInfoMap, which is indexed by expression.
      Parameters:
        `exp` - the expression for which information is required