net.sf.saxon.expr

## Class LastItemExpression

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

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

      public final class LastItemExpression
      extends SingleItemFilter

  A LastItemExpression returns the last item in the sequence returned by a given base expression. The evaluation strategy is to read the input sequence with a one-item lookahead.
  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, INHERITED_CONTEXT, INSPECTION_CONTEXT, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, NAVIGATION_CONTEXT, NODE_VALUE_CONTEXT, PROCESS_METHOD, PUSH_SELECTION, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, W3C_CONSUMING, W3C_FREE_RANGING, W3C_GROUP_CONSUMING, W3C_MOTIONLESS, WATCH_METHOD`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LastItemExpression(Expression base)` Constructor

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Expression` | `copy()` Copy an expression.
    `Item` | `evaluateItem(XPathContext context)` Evaluate the expression
    `ExpressionCompiler` | `getExpressionCompiler()` Return the compiler of the LastItem expression
    `String` | `getExpressionName()` Get a name identifying the kind of expression, in terms meaningful to a user.

    - ### Methods inherited from class net.sf.saxon.expr.SingleItemFilter

      `computeCardinality, optimize, promote`

    - ### 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, doPromotion, dynamicError, effectiveBooleanValue, evaluateAsString, evaluatePendingUpdates, explain, getCardinality, getColumnNumber, getColumnNumber, getConstructType, getContainer, getDependencies, getEvaluationMethod, getExecutable, getHostLanguage, getImplementationMethod, getIntegerBounds, getIntrinsicDependencies, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getStreamability, getStreamingAdjunct, getSystemId, getSystemId, hasVariableBinding, implementsStaticTypeCheck, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterate, iterateEvents, iterateSubExpressionInfo, markTailFunctionCalls, process, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, staticTypeCheck, suppressValidation, toPattern, toStreamingPattern, typeError`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### LastItemExpression

          public LastItemExpression(Expression base)

      Constructor
      Parameters:
        `base` - A sequence expression denoting sequence whose first item is to be returned

  - ### Method Detail

    - #### copy

          public Expression copy()

      Copy an expression. This makes a deep copy.
      Specified by:
        `copy` in class `Expression`
      Returns:
        the copy of the original expression

    - #### evaluateItem

          public Item evaluateItem(XPathContext context)
                            throws XPathException

      Evaluate the expression
      Overrides:
        `evaluateItem` in class `Expression`
      Parameters:
        `context` - The context in which the expression is to be evaluated
      Returns:
        the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
      Throws:
        `XPathException` - if any dynamic error occurs evaluating the expression

    - #### getExpressionCompiler

          public ExpressionCompiler getExpressionCompiler()

      Return the compiler of the LastItem expression
      Overrides:
        `getExpressionCompiler` in class `Expression`
      Returns:
        the relevant ExpressionCompiler

    - #### getExpressionName

          public String getExpressionName()

      Description copied from class: `Expression`
      Get a name identifying the kind of expression, in terms meaningful to a user.
      Overrides:
        `getExpressionName` in class `Expression`
      Returns:
        a name identifying the kind of expression, in terms meaningful to a user. The name will always be in the form of a lexical XML QName, and should match the name used in explain() output displaying the expression.

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