Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.saxonica.extra
Class OptimizerSA

    java.lang.Object
      net.sf.saxon.expr.Optimizer
          com.saxonica.extra.OptimizerSA

All Implemented Interfaces:
  Serializable

    public class OptimizerSA

extends Optimizer

This class doesn't actually do any optimization itself, despite the name. Rather, it is intended to act as a factory for implementation classes that perform optimization, so that the appropriate level of optimization can be selected.

See Also:
  Serialized Form

Constructor Summary
`OptimizerSA(Configuration config)`

Method Summary
`Expression` | `convertPathExpressionToKey(PathExpression pathExp, StaticContext env)` Examine a path expression to see whether it can be replaced by a call on the key() function; if so, generate an appropriate key definition and return the call on key().
`FilterExpression` | `convertToFilterExpression(PathExpression pathExp, TypeHierarchy th)` Convert a path expression such as a/b/c[predicate] into a filter expression of the form (a/b/c)[predicate].
`int` | `isIndexableFilter(Expression filter)` Test whether a filter predicate is indexable.
`Value` | `makeClosure(Expression expression, int ref, XPathContext context)` Make a Closure, given the expected reference count
`BinaryExpression` | `makeGeneralComparison(Expression p0, int op, Expression p1, boolean backwardsCompatible)` Create a GeneralComparison expression
`ValueRepresentation` | `makeIndexedValue(SequenceIterator iter)` Create an indexed value
`Expression` | `optimizeCopy(Expression select)` Attempt to optimize a copy operation.
`Expression` | `optimizeStreamingCopy(Expression select)` Given a select expression, determine whether it is a candidate for sequential processing, and if so, return a SequentialCopy expression that does the work.
`Expression` | `tryIndexedFilter(FilterExpression f, StaticContext env, boolean indexFirstOperand)` Try converting a filter expression to a call on the key function.

Methods inherited from class net.sf.saxon.expr.Optimizer
`getConfiguration`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### OptimizerSA

    public OptimizerSA(Configuration config)

Method Detail

### makeGeneralComparison

    public BinaryExpression makeGeneralComparison(Expression p0,
                                                  int op,
                                                  Expression p1,
                                                  boolean backwardsCompatible)

  Create a GeneralComparison expression

  Overrides:
    `makeGeneralComparison` in class `Optimizer`

### optimizeCopy

    public Expression optimizeCopy(Expression select)
                            throws XPathException

  Attempt to optimize a copy operation. Return null if no optimization is possible.

  Overrides:
    `optimizeCopy` in class `Optimizer`
  Parameters:
    `select` - the expression that selects the items to be copied
  Returns:
    null if no optimization is possible, or an expression that does an optimized copy of these items otherwise
  Throws:
    `XPathException`

### optimizeStreamingCopy

    public Expression optimizeStreamingCopy(Expression select)
                                     throws XPathException

  Given a select expression, determine whether it is a candidate for sequential processing, and if so, return a SequentialCopy expression that does the work.

  To qualify, the select expression must be a path expression that starts with a call on doc() or document(), and whose subsequent steps are all axis steps using the child, descendant, and attribute axes only; there must be no predicates.

  Throws:
    `XPathException`

### makeClosure

    public Value makeClosure(Expression expression,
                             int ref,
                             XPathContext context)
                      throws XPathException

  Make a Closure, given the expected reference count

  Overrides:
    `makeClosure` in class `Optimizer`
  Throws:
    `XPathException`

### convertPathExpressionToKey

    public Expression convertPathExpressionToKey(PathExpression pathExp,
                                                 StaticContext env)
                                          throws XPathException

  Examine a path expression to see whether it can be replaced by a call on the key() function; if so, generate an appropriate key definition and return the call on key(). If not, return null.

  Overrides:
    `convertPathExpressionToKey` in class `Optimizer`
  Parameters:
    `pathExp` - The path expression to be converted.
  Throws:
    `XPathException`

### tryIndexedFilter

    public Expression tryIndexedFilter(FilterExpression f,
                                       StaticContext env,
                                       boolean indexFirstOperand)

  Try converting a filter expression to a call on the key function. Return the supplied expression unchanged if not possible

  Overrides:
    `tryIndexedFilter` in class `Optimizer`

### convertToFilterExpression

    public FilterExpression convertToFilterExpression(PathExpression pathExp,
                                                      TypeHierarchy th)
                                               throws StaticError

  Convert a path expression such as a/b/c[predicate] into a filter expression of the form (a/b/c)[predicate]. This is possible whenever the predicate is non-positional. The conversion is useful in the case where the path expression appears inside a loop, where the predicate depends on the loop variable but a/b/c does not.

  Overrides:
    `convertToFilterExpression` in class `Optimizer`
  Parameters:
    `pathExp` - the path expression to be converted
  Returns:
    the resulting filterexpression if conversion is possible, or null if not
  Throws:
    `StaticError`

### isIndexableFilter

    public int isIndexableFilter(Expression filter)

  Test whether a filter predicate is indexable.

  Overrides:
    `isIndexableFilter` in class `Optimizer`
  Parameters:
    `filter` - the predicate expression
  Returns:
    0 if not indexable; +1 if the predicate is in the form expression=value; -1 if it is in the form value=expression

### makeIndexedValue

    public ValueRepresentation makeIndexedValue(SequenceIterator iter)
                                         throws XPathException

  Create an indexed value

  Overrides:
    `makeIndexedValue` in class `Optimizer`
  Throws:
    `XPathException`

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Michael H. Kay. All rights reserved.