Class CurrentGroupCall
- java.lang.Object
-
- net.sf.saxon.expr.Expression
-
- net.sf.saxon.functions.CurrentGroupCall
-
- All Implemented Interfaces:
Callable
,ExportAgent
,Locatable
,IdentityComparable
,Traceable
public class CurrentGroupCall extends Expression implements Callable
Implements the XSLT function current-group()
-
-
Field Summary
-
Fields inherited from class net.sf.saxon.expr.Expression
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, MAX_COST, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, UPDATE_METHOD, WATCH_METHOD
-
-
Constructor Summary
Constructors Constructor Description CurrentGroupCall()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Sequence
call(XPathContext context, Sequence[] arguments)
Call the Callable (used from generated bytecode).protected int
computeCardinality()
Compute the static cardinality of this expressionint
computeSpecialProperties()
Determine the special properties of this expression.Expression
copy(RebindingMap rebindings)
Copy an expression.void
export(ExpressionPresenter out)
Diagnostic print of expression structure.static ForEachGroup
findControllingInstruction(Expression exp)
ForEachGroup
getControllingInstruction()
Get the innermost containing xsl:for-each-group instruction, if there is oneint
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().int
getIntrinsicDependencies()
Determine the dependenciesItemType
getItemType()
Determine the item type of the value returned by the functionExpression
getScopingExpression()
Get the innermost scoping expression of this expression, for expressions that directly depend on something in the dynamic context.java.lang.String
getStreamerName()
Get the (partial) name of a class that supports streaming of this kind of expressionboolean
isInHigherOrderOperand()
Determine whether the current-group() function is executed repeatedly within a single iteration of the containing xsl:for-each-groupSequenceIterator
iterate(XPathContext c)
Return an iteration over the result sequencevoid
resetLocalStaticProperties()
Reset the static properties of the expression to -1, so that they have to be recomputed next time they are used.void
setControllingInstruction(ForEachGroup instruction, ItemType itemType, boolean isHigherOrder)
Set the containing xsl:for-each-group instruction, if there is onejava.lang.String
toShortString()
Produce a short string identifying the expression for use in error messagesjava.lang.String
toString()
The toString() method for an expression attempts to give a representation of the expression in an XPath-like form.-
Methods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, allowExtractingCommonSubexpressions, checkedOperands, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeHashCode, computeStaticProperties, dynamicError, effectiveBooleanValue, equals, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getConfiguration, getCost, getDependencies, getEvaluationMethod, getExpressionName, getExtraProperty, getIntegerBounds, getInterpretedExpression, getLocalRetainedStaticContext, getLocation, getNetCost, getObjectName, getPackageData, getParentExpression, getProperties, getProperty, getRetainedStaticContext, getSlotsUsed, getSpecialProperties, getStaticBaseURI, getStaticBaseURIString, getStaticType, getStaticUType, getTracingTag, hasCompatibleStaticContext, hashCode, hasSpecialProperty, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isCallOn, isEqual, isIdentical, isInstruction, isLiftable, isMultiThreaded, isStaticPropertiesKnown, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, markTailFunctionCalls, operandList, operands, operandSparseList, optimize, optimizeChildren, prepareForStreaming, process, restoreParentPointers, setEvaluationMethod, setExtraProperty, setFiltered, setFlattened, setLocation, setParentExpression, setRetainedStaticContext, setRetainedStaticContextLocally, setRetainedStaticContextThoroughly, setStaticProperty, simplify, simplifyChildren, staticTypeCheck, suppressValidation, toPattern, typeCheck, typeCheckChildren, typeError, unordered, verifyParentPointers
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface net.sf.saxon.trace.Traceable
gatherProperties
-
-
-
-
Method Detail
-
getScopingExpression
public Expression getScopingExpression()
Get the innermost scoping expression of this expression, for expressions that directly depend on something in the dynamic context. For example, in the case of a local variable reference this is the expression that causes the relevant variable to be bound; for a context item expression it is the innermost focus-setting container. For expressions that have no intrinsic dependency on the dynamic context, the value returned is null; the scoping container for such an expression is the innermost scoping container of its operands.- Overrides:
getScopingExpression
in classExpression
- Returns:
- the innermost scoping container of this expression
-
setControllingInstruction
public void setControllingInstruction(ForEachGroup instruction, ItemType itemType, boolean isHigherOrder)
Set the containing xsl:for-each-group instruction, if there is one- Parameters:
instruction
- the (innermost) containing xsl:for-each-group instructionitemType
- the statically inferred item type of the grouping populationisHigherOrder
- true typically if the current-group() expression is evaluated more than once during evaluation of the body of the for-each-group instruction; or more generally, if there is an operand on the path between the controlling for-each-group instruction and this current-group() call that is a higher-order operand of its parent instruction.
-
resetLocalStaticProperties
public void resetLocalStaticProperties()
Description copied from class:Expression
Reset the static properties of the expression to -1, so that they have to be recomputed next time they are used.- Overrides:
resetLocalStaticProperties
in classExpression
-
getControllingInstruction
public ForEachGroup getControllingInstruction()
Get the innermost containing xsl:for-each-group instruction, if there is one- Returns:
- the innermost containing xsl:for-each-group instruction
-
findControllingInstruction
public static ForEachGroup findControllingInstruction(Expression exp)
-
isInHigherOrderOperand
public boolean isInHigherOrderOperand()
Determine whether the current-group() function is executed repeatedly within a single iteration of the containing xsl:for-each-group- Returns:
- true if it is evaluated repeatedly
-
getItemType
public ItemType getItemType()
Determine the item type of the value returned by the function- Specified by:
getItemType
in classExpression
- Returns:
- a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)
-
getIntrinsicDependencies
public int getIntrinsicDependencies()
Determine the dependencies- Overrides:
getIntrinsicDependencies
in classExpression
- Returns:
- a set of bit-significant flags identifying the "intrinsic" dependencies. The flags are documented in class net.sf.saxon.value.StaticProperty
-
computeCardinality
protected int computeCardinality()
Compute the static cardinality of this expression- Specified by:
computeCardinality
in classExpression
- Returns:
- the computed cardinality, as one of the values
StaticProperty.ALLOWS_ZERO_OR_ONE
,StaticProperty.EXACTLY_ONE
,StaticProperty.ALLOWS_ONE_OR_MORE
,StaticProperty.ALLOWS_ZERO_OR_MORE
-
getImplementationMethod
public int getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process(). This method indicates which of these methods is provided directly. The other methods will always be available indirectly, using an implementation that relies on one of the other methods.- Specified by:
getImplementationMethod
in classExpression
- Returns:
- the implementation method, for example
Expression.ITERATE_METHOD
orExpression.EVALUATE_METHOD
orExpression.PROCESS_METHOD
-
export
public void export(ExpressionPresenter out) throws XPathException
Diagnostic print of expression structure. The abstract expression tree is written to the supplied output destination.- Specified by:
export
in interfaceExportAgent
- Specified by:
export
in classExpression
- Parameters:
out
- the expression presenter used to display the structure- Throws:
XPathException
- if the export fails, for example if an expression is found that won't work in the target environment.
-
computeSpecialProperties
public int computeSpecialProperties()
Determine the special properties of this expression. The properties such as document-ordering are the same as the properties of the grouping population as a whole.- Overrides:
computeSpecialProperties
in classExpression
- Returns:
StaticProperty.NO_NODES_NEWLY_CREATED
(unless the variable is assignable using saxon:assign)
-
copy
public Expression copy(RebindingMap rebindings)
Description copied from class:Expression
Copy an expression. This makes a deep copy.- Specified by:
copy
in classExpression
- Parameters:
rebindings
- a mutable list of (old binding, new binding) pairs that is used to update the bindings held in any local variable references that are copied.- Returns:
- the copy of the original expression
-
iterate
public SequenceIterator iterate(XPathContext c) throws XPathException
Return an iteration over the result sequence- Overrides:
iterate
in classExpression
- Parameters:
c
- supplies the context for evaluation- Returns:
- a SequenceIterator that can be used to iterate over the result of the expression
- Throws:
XPathException
- if any dynamic error occurs evaluating the expression
-
call
public Sequence call(XPathContext context, Sequence[] arguments) throws XPathException
Call the Callable (used from generated bytecode).- Specified by:
call
in interfaceCallable
- Parameters:
context
- the dynamic evaluation contextarguments
- the values of the arguments, supplied as Sequences.Generally it is advisable, if calling iterate() to process a supplied sequence, to call it only once; if the value is required more than once, it should first be converted to a
GroundedValue
by calling the utility method SequenceTool.toGroundedValue().If the expected value is a single item, the item should be obtained by calling Sequence.head(): it cannot be assumed that the item will be passed as an instance of
Item
orAtomicValue
.It is the caller's responsibility to perform any type conversions required to convert arguments to the type expected by the callee. An exception is where this Callable is explicitly an argument-converting wrapper around the original Callable.
- Returns:
- the result of the evaluation, in the form of a Sequence. It is the responsibility of the callee to ensure that the type of result conforms to the expected result type.
- Throws:
XPathException
- if a dynamic error occurs during the evaluation of the expression
-
toString
public java.lang.String toString()
The toString() method for an expression attempts to give a representation of the expression in an XPath-like form.
For subclasses of Expression that represent XPath expressions, the result should always be a string that parses as an XPath 3.0 expression. The expression produced should be equivalent to the original making certain assumptions about the static context. In general the expansion will make no assumptions about namespace bindings, except that (a) the prefix "xs" is used to refer to the XML Schema namespace, and (b) the default funcion namespace is assumed to be the "fn" namespace.
In the case of XSLT instructions and XQuery expressions, the toString() method gives an abstracted view of the syntax that is not designed in general to be parseable.
- Overrides:
toString
in classExpression
- Returns:
- a representation of the expression as a string
-
toShortString
public java.lang.String toShortString()
Produce a short string identifying the expression for use in error messages- Overrides:
toShortString
in classExpression
- Returns:
- a short string, sufficient to identify the expression
-
getStreamerName
public java.lang.String getStreamerName()
Get the (partial) name of a class that supports streaming of this kind of expression- Overrides:
getStreamerName
in classExpression
- Returns:
- the partial name of a class that can be instantiated to provide streaming support in Saxon-EE, or null if there is no such class
-
-