Package net.sf.saxon.functions
Class ContextItemAccessorFunction
- java.lang.Object
- 
- net.sf.saxon.functions.AbstractFunction
- 
- net.sf.saxon.functions.SystemFunction
- 
- net.sf.saxon.functions.ContextAccessorFunction
- 
- net.sf.saxon.functions.ContextItemAccessorFunction
 
 
 
 
- 
- All Implemented Interfaces:
- Callable,- Function,- GroundedValue,- Item,- Sequence
 - Direct Known Subclasses:
- ContextItemAccessorFunction.Number_0,- ContextItemAccessorFunction.StringAccessor
 
 public class ContextItemAccessorFunction extends ContextAccessorFunction A ContextItemAccessorFunction is a function that takes no arguments, but operates implicitly on the context item. In the case of a dynamic call, the context item that is used is the one at the point where the function item is created. Because these functions depend on the context only, with no additional arguments, the function can be evaluated as soon as the context is bound. The function is therefore replaced at this stage with a constant function, that is, one that always returns the same value.
- 
- 
Nested Class SummaryNested Classes Modifier and Type Class Description static classContextItemAccessorFunction.Number_0Subclass of ContextItemAccessorFunction to handle number().static classContextItemAccessorFunction.StringAccessorSubclass of ContextItemAccessorFunction to handle string-length() and normalize-space().
 - 
Constructor SummaryConstructors Constructor Description ContextItemAccessorFunction()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description FunctionbindContext(XPathContext context)Bind a context item to appear as part of the function's closure.Sequencecall(XPathContext context, Sequence[] arguments)Evaluate the expression.GroundedValueevaluate(Item item, XPathContext context)Evaluate the function.ExpressionmakeContextItemExplicit()Create a system function call on this function in which the context item is supplied as an explicit argumentExpressionmakeFunctionCall(Expression[] arguments)Make a static call on this function, with specified arguments.- 
Methods inherited from class net.sf.saxon.functions.SystemFunctiondependsOnContextItem, dynamicCall, equals, export, exportAdditionalArguments, exportAttributes, fixArguments, getArity, getCardinality, getCompilerName, getContextNode, getDescription, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getIntegerBounds, getNetCost, getOperandRoles, getRequiredType, getResultItemType, getResultItemType, getRetainedStaticContext, getSpecialProperties, getStaticBaseUriString, getStreamerName, getUniStringArg, hashCode, importAttributes, isSequenceVariadic, isTrustedResultType, makeCall, makeFunction, makeOptimizedFunctionCall, resultIfEmpty, setArity, setDetails, setRetainedStaticContext, supplyTypeInformation, toShortString, toString, typeCheckCaller
 - 
Methods inherited from class net.sf.saxon.functions.AbstractFunctionatomize, deepEquals, effectiveBooleanValue, getAnnotations, getSerialNumber, getUnicodeStringValue, isArray, isMap, makeNewContext, simplify, typeCheck
 - 
Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, wait
 - 
Methods inherited from interface net.sf.saxon.om.GroundedValueasIterable, concatenate, containsNode, materialize
 - 
Methods inherited from interface net.sf.saxon.om.ItemgetLength, getStringValue, head, isStreamed, itemAt, iterate, reduce, subsequence
 - 
Methods inherited from interface net.sf.saxon.om.SequencemakeRepeatable
 
- 
 
- 
- 
- 
Method Detail- 
bindContextpublic Function bindContext(XPathContext context) throws XPathException Bind a context item to appear as part of the function's closure. If this method has been called, the supplied context item will be used in preference to the context item at the point where the function is actually called.- Specified by:
- bindContextin class- ContextAccessorFunction
- Parameters:
- context- the context to which the function applies. Must not be null.
- Throws:
- XPathException
 
 - 
evaluatepublic GroundedValue evaluate(Item item, XPathContext context) throws XPathException Evaluate the function. This is done by creating a function of the same name, with the context item as an explicit argument, and evaluating that.- Parameters:
- item- the context item
- context- XPath dynamic context (not normally used)
- Returns:
- the result of the function
- Throws:
- XPathException- in the event of a dynamic error
 
 - 
callpublic Sequence call(XPathContext context, Sequence[] arguments) throws XPathException Evaluate the expression. This method is not normally used, but is provided to satisfy the interface.- Specified by:
- callin interface- Callable
- Overrides:
- callin class- ContextAccessorFunction
- Parameters:
- context- the dynamic evaluation context
- arguments- the values of the arguments, supplied as Sequences
- Returns:
- the result of the evaluation, in the form of a Sequence
- Throws:
- XPathException- if a dynamic error occurs during the evaluation of the expression
 
 - 
makeFunctionCallpublic Expression makeFunctionCall(Expression[] arguments) Make a static call on this function, with specified arguments.- Overrides:
- makeFunctionCallin class- SystemFunction
- Parameters:
- arguments- the supplied arguments to the function call. This will always be an empty array, since this is a zero-arity function.
- Returns:
- This implementation returns a call on the equivalent arity-1 version of the function, supplying "." as an explicit argument.
 
 - 
makeContextItemExplicitpublic Expression makeContextItemExplicit() Create a system function call on this function in which the context item is supplied as an explicit argument- Returns:
- an equivalent function call in which the context item is supplied explicitly.
 
 
- 
 
-