Package net.sf.saxon.functions
Class PositionAndLast
- java.lang.Object
-
- net.sf.saxon.functions.AbstractFunction
-
- net.sf.saxon.functions.SystemFunction
-
- net.sf.saxon.functions.ContextAccessorFunction
-
- net.sf.saxon.functions.PositionAndLast
-
- All Implemented Interfaces:
Callable
,Function
,GroundedValue
,Item
,Sequence
- Direct Known Subclasses:
PositionAndLast.Last
,PositionAndLast.Position
public abstract class PositionAndLast extends ContextAccessorFunction
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PositionAndLast.Last
static class
PositionAndLast.Position
-
Constructor Summary
Constructors Constructor Description PositionAndLast()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Function
bindContext(XPathContext context)
Bind a context item to appear as part of the function's closure.IntegerValue
call(XPathContext context, Sequence[] arguments)
Evaluate the expressionabstract Int64Value
evaluateItem(XPathContext c)
Evaluate in a general contextIntegerValue[]
getIntegerBounds()
For an expression that returns an integer or a sequence of integers, get a lower and upper bound on the values of the integers that may be returned, from static analysis.int
getNetCost()
Get an estimate of the net cost of evaluating the function, excluding the cost of evaluating its arguments.boolean
isContextPossiblyUndefined()
Ask whether the context item may possibly be undefinedvoid
supplyTypeInformation(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo, Expression[] arguments)
Method called during static type checking.-
Methods inherited from class net.sf.saxon.functions.SystemFunction
dependsOnContextItem, dynamicCall, equals, export, exportAdditionalArguments, exportAttributes, fixArguments, getArity, getCardinality, getCompilerName, getContextNode, getDescription, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getOperandRoles, getRequiredType, getResultItemType, getResultItemType, getRetainedStaticContext, getSpecialProperties, getStaticBaseUriString, getStreamerName, getUniStringArg, hashCode, importAttributes, isSequenceVariadic, isTrustedResultType, makeCall, makeFunction, makeFunctionCall, makeOptimizedFunctionCall, resultIfEmpty, setArity, setDetails, setRetainedStaticContext, toShortString, toString, typeCheckCaller
-
Methods inherited from class net.sf.saxon.functions.AbstractFunction
atomize, deepEquals, effectiveBooleanValue, getAnnotations, getSerialNumber, getUnicodeStringValue, isArray, isMap, makeNewContext, simplify, typeCheck
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, getStringValue, head, isStreamed, itemAt, iterate, reduce, subsequence
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Method Detail
-
getNetCost
public int getNetCost()
Get an estimate of the net cost of evaluating the function, excluding the cost of evaluating its arguments. The result is 0 for very simple functions like position() and exists(), 1 by default, and higher values for particularly expensive functions.- Overrides:
getNetCost
in classSystemFunction
- Returns:
- the estimated cost
-
bindContext
public Function bindContext(XPathContext context)
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:
bindContext
in classContextAccessorFunction
- Parameters:
context
- the context to which the function applies. Must not be null.
-
getIntegerBounds
public IntegerValue[] getIntegerBounds()
For an expression that returns an integer or a sequence of integers, get a lower and upper bound on the values of the integers that may be returned, from static analysis. The default implementation returns null, meaning "unknown" or "not applicable". Other implementations return an array of two IntegerValue objects, representing the lower and upper bounds respectively. The values UNBOUNDED_LOWER and UNBOUNDED_UPPER are used by convention to indicate that the value may be arbitrarily large. The values MAX_STRING_LENGTH and MAX_SEQUENCE_LENGTH are used to indicate values limited by the size of a string or the size of a sequence.- Overrides:
getIntegerBounds
in classSystemFunction
- Returns:
- the lower and upper bounds of integer values in the result, or null to indicate unknown or not applicable.
-
supplyTypeInformation
public void supplyTypeInformation(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo, Expression[] arguments) throws XPathException
Description copied from class:SystemFunction
Method called during static type checking. This method may be implemented in subclasses so that functions can take advantage of knowledge of the types of the arguments that will be supplied.- Overrides:
supplyTypeInformation
in classSystemFunction
- Parameters:
visitor
- an expression visitor, providing access to the static context and configurationcontextInfo
- information about whether the context item is set, and what its type isarguments
- the expressions appearing as arguments in the function call- Throws:
XPathException
- if an error is detected
-
isContextPossiblyUndefined
public boolean isContextPossiblyUndefined()
Ask whether the context item may possibly be undefined- Returns:
- true if it might be undefined
-
evaluateItem
public abstract Int64Value evaluateItem(XPathContext c) throws XPathException
Evaluate in a general context- Throws:
XPathException
-
call
public IntegerValue call(XPathContext context, Sequence[] arguments) throws XPathException
Evaluate the expression- Specified by:
call
in interfaceCallable
- Overrides:
call
in classContextAccessorFunction
- Parameters:
context
- the dynamic evaluation contextarguments
- 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
-
-