Package net.sf.saxon.functions

## Class Trace

- java.lang.Object
- - net.sf.saxon.functions.AbstractFunction
  - - net.sf.saxon.functions.SystemFunction
    - - net.sf.saxon.functions.Trace

- All Implemented Interfaces:
    `Callable`, `Locatable`, `Function`, `GroundedValue`, `Item`, `Sequence`, `Traceable`

      public class Trace
      extends SystemFunction
      implements Traceable

  This class supports the XPath 2.0 function trace(). The value is traced to the registered output stream (defaulting to System.err), unless a TraceListener is in use, in which case the information is sent to the TraceListener

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `Trace()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `Sequence` | `call​(XPathContext context, Sequence[] arguments)` | Evaluate the expression
    `int` | `getCardinality​(Expression[] arguments)` | Get the cardinality, given knowledge of the actual arguments
    `Location` | `getLocation()` | Get the location of the construct
    `StructuredQName` | `getObjectName()` | Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc.
    `int` | `getSpecialProperties​(Expression[] arguments)` | Get the static properties of this expression (other than its type).
    `java.lang.String` | `getStreamerName()` | Get a name that identifies the class that can be used to evaluate this function in streaming mode, that is, supplying one item or event at a time as it is delivered by the parser.
    `Expression` | `makeFunctionCall​(Expression... arguments)` | Make an expression that either calls this function, or that is equivalent to a call on this function
    `void` | `notifyListener​(java.lang.String label, Sequence val, XPathContext context)` |
    `static void` | `traceItem​(Item val, java.lang.String label, Logger out)` |

    - ### Methods inherited from class net.sf.saxon.functions.SystemFunction

      `dependsOnContextItem, dynamicCall, equals, export, exportAdditionalArguments, exportAttributes, fixArguments, getArity, getCompilerName, getContextNode, getDescription, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getIntegerBounds, getNetCost, getOperandRoles, getRequiredType, getResultItemType, getResultItemType, getRetainedStaticContext, getStaticBaseUriString, importAttributes, isTrustedResultType, makeCall, makeFunction, makeOptimizedFunctionCall, resultIfEmpty, setArity, setDetails, setRetainedStaticContext, supplyTypeInformation, toShortString, toString, typeCheckCaller`

    - ### Methods inherited from class net.sf.saxon.functions.AbstractFunction

      `atomize, deepEquals, effectiveBooleanValue, getAnnotations, getStringValue, getStringValueCS, isArray, isMap, makeNewContext, simplify, typeCheck`

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

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

    - ### Methods inherited from interface net.sf.saxon.om.Function

      `getGenre`

    - ### Methods inherited from interface net.sf.saxon.om.GroundedValue

      `asIterable, concatenate, containsNode, materialize`

    - ### Methods inherited from interface net.sf.saxon.om.Item

      `getLength, head, isStreamed, itemAt, iterate, reduce, subsequence`

    - ### Methods inherited from interface net.sf.saxon.om.Sequence

      `makeRepeatable`

    - ### Methods inherited from interface net.sf.saxon.trace.Traceable

      `gatherProperties`

- - ### Constructor Detail

    - #### Trace

          public Trace()

  - ### Method Detail

    - #### getSpecialProperties

          public int getSpecialProperties​(Expression[] arguments)

      Get the static properties of this expression (other than its type). The result is bit-significant. These properties are used for optimizations. In general, if property bit is set, it is true, but if it is unset, the value is unknown.
      Overrides:
        `getSpecialProperties` in class `SystemFunction`
      Parameters:
        `arguments` - the actual arguments

    - #### getCardinality

          public int getCardinality​(Expression[] arguments)

      Description copied from class: `SystemFunction`
      Get the cardinality, given knowledge of the actual arguments
      Overrides:
        `getCardinality` in class `SystemFunction`
      Parameters:
        `arguments` - the actual arguments supplied
      Returns:
        the most precise available cardinality that the function will return

    - #### notifyListener

          public void notifyListener​(java.lang.String label,
                                     Sequence val,
                                     XPathContext context)

    - #### makeFunctionCall

          public Expression makeFunctionCall​(Expression... arguments)

      Description copied from class: `SystemFunction`
      Make an expression that either calls this function, or that is equivalent to a call on this function
      Overrides:
        `makeFunctionCall` in class `SystemFunction`
      Parameters:
        `arguments` - the supplied arguments to the function call
      Returns:
        either a function call on this function, or an expression that delivers the same result

    - #### traceItem

          public static void traceItem​(Item val,
                                       java.lang.String label,
                                       Logger out)

    - #### getLocation

          public Location getLocation()

      Description copied from interface: `Locatable`
      Get the location of the construct
      Specified by:
        `getLocation` in interface `Locatable`
      Returns:
        the location. If no location information is available, the method should return `Loc.NONE` rather than returning null. However, callers would be well advised to check for the result being null.

    - #### call

          public Sequence call​(XPathContext context,
                               Sequence[] arguments)
                        throws XPathException

      Evaluate the expression
      Specified by:
        `call` in interface `Callable`
      Specified by:
        `call` in interface `Function`
      Parameters:
        `context` - the dynamic evaluation context
        `arguments` - the values of the arguments, supplied as SequenceIterators
      Returns:
        the result of the evaluation, in the form of a SequenceIterator
      Throws:
        `XPathException` - if a dynamic error occurs during the evaluation of the expression

    - #### getObjectName

          public StructuredQName getObjectName()

      Get a name identifying the object of the expression, for example a function name, template name, variable name, key name, element name, etc. This is used only where the name is known statically.
      Specified by:
        `getObjectName` in interface `Traceable`
      Returns:
        the QName of the object declared or manipulated by this instruction or expression

    - #### getStreamerName

          public java.lang.String getStreamerName()

      Description copied from class: `SystemFunction`
      Get a name that identifies the class that can be used to evaluate this function in streaming mode, that is, supplying one item or event at a time as it is delivered by the parser. Special streaming support is generally available in Saxon-EE for all system functions that take a sequence as their argument.
      Overrides:
        `getStreamerName` in class `SystemFunction`
      Returns:
        a name that identifies a class that supports streamed evaluation of this system function, or null if no such class is available. The mapping of names to classes is defined in the Saxon-EE class `StreamerMap`. In non-streaming Saxon editions (HE and PE) the method always returns null.