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() |
java.lang.String |
getCompilerName()
Get the (local) name of a class that can be used to generate bytecode for this
system function
|
ItemType |
getResultItemType(Expression[] args)
Get the return type, given knowledge of the actual arguments
|
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.
|
void |
importAttributes(java.util.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
|
copy, getPreAllocatedAtomicComparer, getStringCollator, isSubstringMatchingFunction, preAllocateComparer, setCollationName, setRetainedStaticContext
dependsOnContextItem, dynamicCall, equals, export, exportAdditionalArguments, fixArguments, getArity, getContextNode, getDescription, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getFunctionName, getIntegerBounds, getNetCost, getOperandRoles, getRequiredType, getResultItemType, getRetainedStaticContext, getSpecialProperties, getStaticBaseUriString, isTrustedResultType, makeCall, makeFunction, makeFunctionCall, resultIfEmpty, setArity, setDetails, typeCheckCaller
atomize, deepEquals, effectiveBooleanValue, getAnnotations, getStringValue, getStringValueCS, isArray, isMap, makeNewContext, simplify, typeCheck
getLength, head, isStreamed, 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 ItemType getResultItemType(Expression[] args)
SystemFunction
getResultItemType
in class SystemFunction
args
- the actual arguments suppliedpublic 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(java.util.Properties attributes) throws XPathException
SystemFunction
importAttributes
in class CollatingFunctionFixed
attributes
- the attributes, as a properties objectXPathException
public java.lang.String getCompilerName()
SystemFunction
getCompilerName
in class SystemFunction
public java.lang.String getStreamerName()
SystemFunction
getStreamerName
in class SystemFunction
StreamerMap
. In non-streaming Saxon editions
(HE and PE) the method always returns null.Copyright (c) 2004-2018 Saxonica Limited. All rights reserved.