public abstract class Minimax extends CollatingFunctionFixed
Modifier and Type | Class and Description |
---|---|
static class |
Minimax.Max
Concrete subclass to define the fn:max() function
|
static class |
Minimax.Min
Concrete subclass to define the fn:min() function
|
Constructor and Description |
---|
Minimax() |
Modifier and Type | Method and Description |
---|---|
ZeroOrOne<AtomicValue> |
call(XPathContext context,
Sequence[] arguments)
Evaluate the function
|
void |
exportAttributes(ExpressionPresenter out)
Export any context attributes held within the SystemFunction object.
|
PlainType |
getArgumentType() |
AtomicComparer |
getAtomicComparer(XPathContext context)
During evaluation, get the pre-allocated atomic comparer if available, or allocate a new one otherwise
|
int |
getCardinality(Expression[] arguments)
Determine the cardinality of the function.
|
AtomicComparer |
getComparer() |
ExpressionCompiler |
getExpressionCompiler()
Return the compiler of the Minimax expression
|
MinimaxAdjunct |
getStreamingAdjunct()
Get a class that supports streamed evaluation of this expression
|
void |
importAttributes(Properties attributes)
Import any attributes found in the export file, that is, any attributes output using
the exportAttributes method
|
boolean |
isIgnoreNaN()
Test whether NaN values are to be ignored
|
abstract boolean |
isMaxFunction()
Method to be implemented in subclasses to indicate whether the function implements
fn:min() or fn:max()
|
Expression |
makeOptimizedFunctionCall(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo,
Expression... arguments)
Allow the function to create an optimized call based on the values of the actual arguments
|
static AtomicValue |
minimax(SequenceIterator iter,
boolean isMaxFunction,
AtomicComparer atomicComparer,
boolean ignoreNaN,
XPathContext context)
Static method to evaluate the minimum or maximum of a sequence
|
void |
setIgnoreNaN(boolean ignore)
Indicate whether NaN values should be ignored.
|
void |
supplyTypeInformation(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType,
Expression[] arguments)
Static analysis: preallocate a comparer if possible
|
getPreAllocatedAtomicComparer, getStringCollator, preAllocateComparer, setCollationName, setRetainedStaticContext
equals, export, getArity, getContextNode, getDescription, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getIntegerBounds, getOperandRoles, getRequiredType, getResultItemType, getResultItemType, getRetainedStaticContext, getSpecialProperties, getStaticBaseUriString, makeCall, makeFunction, makeFunctionCall, resultIfEmpty, setArity, setDetails, typeCheckCaller
atomize, deepEquals, effectiveBooleanValue, getStringValue, getStringValueCS, isArray, isMap, optimize, simplify, typeCheck
getLength, head, itemAt, iterate, reduce, subsequence
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLength, head, itemAt, reduce, subsequence
public abstract boolean isMaxFunction()
public void setIgnoreNaN(boolean ignore)
ignore
- true if NaN values are to be ignored when computing the min or max.public boolean isIgnoreNaN()
public AtomicComparer getComparer()
public PlainType getArgumentType()
public void supplyTypeInformation(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType, Expression[] arguments) throws XPathException
supplyTypeInformation
in class SystemFunction
visitor
- an expression visitor, providing access to the static context and configurationcontextItemType
- information about whether the context item is set, and what its type isarguments
- the expressions appearing as arguments in the function callXPathException
public int getCardinality(Expression[] arguments)
getCardinality
in class SystemFunction
arguments
- the actual arguments suppliedpublic Expression makeOptimizedFunctionCall(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo, Expression... arguments) throws XPathException
SystemFunction
makeOptimizedFunctionCall
in class SystemFunction
visitor
- the expression visitorcontextInfo
- information about the context itemarguments
- the supplied arguments to the function call. Note: modifying the contents
of this array should not be attempted, it is likely to have no effect.XPathException
- if an error is detectedpublic AtomicComparer getAtomicComparer(XPathContext context)
CollatingFunctionFixed
getAtomicComparer
in class CollatingFunctionFixed
context
- the dynamic evaluation contextpublic static AtomicValue minimax(SequenceIterator iter, boolean isMaxFunction, AtomicComparer atomicComparer, boolean ignoreNaN, XPathContext context) throws XPathException
iter
- Iterator over the input sequenceisMaxFunction
- true for the max() function, false for min()atomicComparer
- an AtomicComparer used to compare valuesignoreNaN
- true if NaN values are to be ignoredcontext
- dynamic evaluation contextXPathException
- typically if non-comparable values are found in the sequencepublic ZeroOrOne<AtomicValue> call(XPathContext context, Sequence[] arguments) throws XPathException
context
- the dynamic evaluation contextarguments
- the values of the arguments, supplied as SequencesXPathException
- if a dynamic error occurs during the evaluation of the expressionpublic void exportAttributes(ExpressionPresenter out)
SystemFunction
exportAttributes
in class CollatingFunctionFixed
out
- the export destinationpublic void importAttributes(Properties attributes) throws XPathException
SystemFunction
importAttributes
in class CollatingFunctionFixed
attributes
- the attributes, as a properties objectXPathException
public ExpressionCompiler getExpressionCompiler()
getExpressionCompiler
in class SystemFunction
public MinimaxAdjunct getStreamingAdjunct()
getStreamingAdjunct
in class SystemFunction
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.