Class CurrentGroupingKeyCall

java.lang.Object
net.sf.saxon.expr.Expression
net.sf.saxon.functions.CurrentGroupingKeyCall
All Implemented Interfaces:
Callable, ExportAgent, Locatable, IdentityComparable, Traceable

public class CurrentGroupingKeyCall extends Expression implements Callable
Implements the XSLT function current-grouping-key()
  • Constructor Details

    • CurrentGroupingKeyCall

      public CurrentGroupingKeyCall()
  • Method Details

    • 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 class Expression
      Returns:
      the innermost scoping container of this expression
    • computeCardinality

      protected int computeCardinality()
      Compute the static cardinality of this expression
      Specified by:
      computeCardinality in class Expression
      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 class Expression
      Returns:
      the implementation method, for example Expression.ITERATE_METHOD or Expression.EVALUATE_METHOD or Expression.PROCESS_METHOD
    • getItemType

      public ItemType getItemType()
      Determine the data type of the expression, if possible. All expression return sequences, in general; this method determines the type of the items within the sequence, assuming that (a) this is known in advance, and (b) it is the same for all items in the sequence.

      This method should always return a result, though it may be the best approximation that is available at the time.

      Specified by:
      getItemType in class Expression
      Returns:
      a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)
    • 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 interface ExportAgent
      Specified by:
      export in class Expression
      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.
    • copy

      public Expression copy(RebindingMap rebindings)
      Copy an expression. This makes a deep copy.
      Specified by:
      copy in class Expression
      Parameters:
      rebindings - variables to be renamed
      Returns:
      the copy of the original expression
    • getIntrinsicDependencies

      public int getIntrinsicDependencies()
      Determine the dependencies
      Overrides:
      getIntrinsicDependencies in class Expression
      Returns:
      an integer containing bit-significant flags identifying the "intrinsic" dependencies. The flags are documented in class net.sf.saxon.value.StaticProperty
    • iterate

      public SequenceIterator iterate(XPathContext context) throws XPathException
      Evaluate the expression
      Overrides:
      iterate in class Expression
      Parameters:
      context - 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.
      Specified by:
      call in interface Callable
      Parameters:
      context - the dynamic evaluation context
      arguments - 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 or AtomicValue.

      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
    • getElaborator

      public Elaborator getElaborator()
      Make an elaborator for this expression
      Overrides:
      getElaborator in class Expression
      Returns:
      an appropriate Elaborator