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 Try

    java.lang.Object
      net.sf.saxon.expr.Expression
          net.sf.saxon.expr.FunctionCall
              net.sf.saxon.functions.SystemFunction
                  com.saxonica.extra.Try

All Implemented Interfaces:
  Serializable, SourceLocator, Container, EvaluableItem, SequenceIterable, InstructionInfoProvider

    public class Try

extends SystemFunction

This class implements the saxon:try() extension function, which is specially recognized by the system because it uses a non-standard approach to evaluating its arguments

See Also:
  Serialized Form

Field Summary

Fields inherited from class net.sf.saxon.expr.Expression
`EVALUATE_METHOD, ITERATE_METHOD, PROCESS_METHOD`

Constructor Summary
`Try()`

Method Summary
`int` | `computeCardinality()` Determine the cardinality of the function.
`Item` | `evaluateItem(XPathContext c)` Evaluate in a general context
`ItemType` | `getItemType(TypeHierarchy th)` Determine the item type of the value returned by the function
`SequenceIterator` | `iterate(XPathContext c)` Iterate over the results of the function
`Expression` | `optimize(Optimizer opt, StaticContext env, ItemType contextItemType)` Type-check the expression.
`Expression` | `simplify(StaticContext env)` Simplify the function call.
`Expression` | `typeCheck(StaticContext env, ItemType contextItemType)` Type-check the expression.

Methods inherited from class net.sf.saxon.functions.SystemFunction
`checkArguments, computeSpecialProperties, display, getDetails, getErrorCodeForTypeErrors, main, makeSystemFunction, setDetails`

Methods inherited from class net.sf.saxon.expr.FunctionCall
`getArguments, getDisplayName, getFunctionNameCode, getNumberOfArguments, iterateSubExpressions, preEvaluate, promote, replaceSubExpression, setArguments, setFunctionNameCode`

Methods inherited from class net.sf.saxon.expr.Expression
`adoptChildExpression, checkPermittedContents, computeDependencies, computeStaticProperties, doPromotion, effectiveBooleanValue, evaluateAsString, getCardinality, getColumnNumber, getContainingProcedure, getDependencies, getExecutable, getHostLanguage, getImplementationMethod, getInstructionInfo, getIntrinsicDependencies, getLineNumber, getLocationId, getLocationProvider, getParentExpression, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, hasBadParentPointer, markTailFunctionCalls, process, resetStaticProperties, setLocationId, setParentExpression, setParentExpression, suppressValidation`

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

Constructor Detail

### Try

    public Try()

Method Detail

### simplify

    public Expression simplify(StaticContext env)
                        throws XPathException

  Simplify the function call. Returns the value of the first argument if this is known statically.

  Overrides:
    `simplify` in class `FunctionCall`
  Returns:
    the simplified expression
  Throws:
    `XPathException` - if an error is discovered during expression rewriting

### typeCheck

    public Expression typeCheck(StaticContext env,
                                ItemType contextItemType)
                         throws XPathException

  Type-check the expression. This also calls preEvaluate() to evaluate the function if all the arguments are constant; functions that do not require this behavior can override the preEvaluate method.

  Overrides:
    `typeCheck` in class `FunctionCall`
  Parameters:
    `env` - the static context of the expression
    `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 to perform necessary run-time type checks, and to perform other type-related optimizations
  Throws:
    `StaticError` - if an error is discovered during this phase (typically a type error)
    `XPathException`

### optimize

    public Expression optimize(Optimizer opt,
                               StaticContext env,
                               ItemType contextItemType)
                        throws XPathException

  Type-check the expression. This also calls preEvaluate() to evaluate the function if all the arguments are constant; functions that do not require this behavior can override the preEvaluate method.

  Overrides:
    `optimize` in class `SystemFunction`
  Parameters:
    `opt` - the optimizer in use. This provides access to supporting functions; it also allows different optimization strategies to be used in different circumstances.
    `env` - the static context of the expression
    `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:
    `StaticError` - if an error is discovered during this phase (typically a type error)
    `XPathException`

### computeCardinality

    public int computeCardinality()

  Determine the cardinality of the function.

  Overrides:
    `computeCardinality` in class `SystemFunction`

### getItemType

    public ItemType getItemType(TypeHierarchy th)

  Determine the item type of the value returned by the function

  Overrides:
    `getItemType` in class `SystemFunction`
  Parameters:
    `th` -
  Returns:
    a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)

### evaluateItem

    public Item evaluateItem(XPathContext c)
                      throws XPathException

  Evaluate in a general context

  Specified by:
    `evaluateItem` in interface `EvaluableItem`
  Overrides:
    `evaluateItem` in class `Expression`
  Parameters:
    `c` - 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

### iterate

    public SequenceIterator iterate(XPathContext c)
                             throws XPathException

  Iterate over the results of the function

  Specified by:
    `iterate` in interface `SequenceIterable`
  Overrides:
    `iterate` in class `Expression`
  Parameters:
    `c` - supplies the context for evaluation
  Returns:
    a SequenceIterator that can be used to iterate over the result of the expression
  Throws:
    `XPathException` - if any dynamic error occurs evaluating the expression

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.