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

## net.sf.saxon.expr
Class SingleItemFilter

    java.lang.Object
      net.sf.saxon.expr.Expression
          net.sf.saxon.expr.UnaryExpression
              net.sf.saxon.expr.SingleItemFilter

All Implemented Interfaces:
  Serializable, SourceLocator, LocationProvider, SaxonLocator, InstructionInfo, Locator

Direct Known Subclasses:
  FirstItemExpression, LastItemExpression

    public abstract class SingleItemFilter

extends UnaryExpression

A SingleItemFilter is an expression that selects zero or one items from a supplied sequence

See Also:
  Serialized Form

Field Summary

Fields inherited from class net.sf.saxon.expr.UnaryExpression
`operand`

Fields inherited from class net.sf.saxon.expr.Expression
`EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, EVENT_FEED_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, WATCH_METHOD`

Constructor Summary
`SingleItemFilter()`

Method Summary
`int` | `computeCardinality()` Get the static cardinality: this implementation is appropriate for [1] and [last()] which will always return something if the input is non-empty
`Expression` | `optimize(ExpressionVisitor visitor, ExpressionVisitor.ContextItemType contextItemType)` Perform optimisation of an expression and its subexpressions.
`Expression` | `promote(PromotionOffer offer, Expression parent)` Promote this expression if possible

Methods inherited from class net.sf.saxon.expr.UnaryExpression
`computeSpecialProperties, displayOperator, equals, explain, getBaseExpression, getItemType, hashCode, iterateSubExpressions, replaceSubExpression, simplify, toString, typeCheck`

Methods inherited from class net.sf.saxon.expr.Expression
`addToPathMap, adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, copy, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getColumnNumber, getColumnNumber, getConstructType, getContainer, getDependencies, getEvaluationMethod, getExecutable, getExpressionName, getHostLanguage, getImplementationMethod, getIntegerBounds, getIntrinsicDependencies, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, getSystemId, hasLoopingSubexpression, hasVariableBinding, implementsStaticTypeCheck, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterate, iterateEvents, iterateSameFocusSubExpressions, markTailFunctionCalls, process, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, staticTypeCheck, suppressValidation, typeError`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### SingleItemFilter

    public SingleItemFilter()

Method Detail

### optimize

    public Expression optimize(ExpressionVisitor visitor,
                               ExpressionVisitor.ContextItemType contextItemType)
                        throws XPathException

  Perform optimisation of an expression and its subexpressions.

  This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.

  Overrides:
    `optimize` in class `UnaryExpression`
  Parameters:
    `visitor` - an expresion visitor
    `contextItemType` - the static type of "." at the point where this expression is invoked. The parameter is set to null if it is known statically that the context item will be undefined. If the type of the context item is not known statically, the argument is set to `Type.ITEM_TYPE`
  Returns:
    the original expression, rewritten if appropriate to optimize execution
  Throws:
    `XPathException` - if an error is discovered during this phase (typically a type error)

### promote

    public Expression promote(PromotionOffer offer,
                              Expression parent)
                       throws XPathException

  Promote this expression if possible

  Overrides:
    `promote` in class `UnaryExpression`
  Parameters:
    `offer` - details of the offer, for example the offer to move expressions that don't depend on the context to an outer level in the containing expression
    `parent` - the containing expression in the expression tree
  Returns:
    if the offer is not accepted, return this expression unchanged. Otherwise return the result of rewriting the expression to promote this subexpression
  Throws:
    `XPathException` - if any error is detected

### computeCardinality

    public int computeCardinality()

  Get the static cardinality: this implementation is appropriate for [1] and [last()] which will always return something if the input is non-empty

  Overrides:
    `computeCardinality` in class `UnaryExpression`
  Returns:
    the computed cardinality, as one of the values `StaticProperty.ALLOWS_ZERO_OR_ONE`, `StaticProperty.EXACTLY_ONE`, `StaticProperty.ALLOWS_ONE_OR_MORE`, `StaticProperty.ALLOWS_ZERO_OR_MORE`

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

Copyright (c) 2004-2011 Saxonica Limited. All rights reserved.