Class GroupFunction

  extended by org.inria.ns.reflex.xml.xpath.XPathFunction.NamedXPathFunction
      extended by org.inria.ns.reflex.processor.xcl.GroupFunction
All Implemented Interfaces:
DeferrableFunction, XPathFunction

public class GroupFunction
extends XPathFunction.NamedXPathFunction
implements XPathFunction, DeferrableFunction

The xcl:group() function group items of a #adt:list regarding one or more grouping criteria.

The result is a #adt:list of #adt:list. Each inner list contains all the items of the same group. All inner lists are items of the outer list. While the outer list is browsed, the current object is set to the first item of the inner list.

Items of the outer list and the inner list are built dynamically while browsing the list to group. The outer list doesn't intend to be browsed entirely ignoring the items of the inner list. If inner groups are not browsed, a new outer group item is considered with the remainder. Because the outer list doesn't read in advance items of the list to group (it can't predict if the next item is in the same group or not).

*** This list must be read forward ; once completed, this list must not be read again. ***

Philippe Poulard

Nested Class Summary
static class GroupFunction.OuterList
          A list used for grouping items according to some criteria.
Nested classes/interfaces inherited from interface org.inria.ns.reflex.xml.xpath.XPathFunction
Constructor Summary
Method Summary
 Object evaluate(XPathContext context, List args)
          Groups item of a list.
 boolean isDeferred(int argument)
          The first argument is not deferred (evaluated to the stuff to group), others are deferred (evaluated for each item of the stuff to group).
Methods inherited from class org.inria.ns.reflex.xml.xpath.XPathFunction.NamedXPathFunction
getQName, setQName
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.inria.ns.reflex.xml.xpath.XPathFunction

Constructor Detail


public GroupFunction()
Method Detail


public Object evaluate(XPathContext context,
                       List args)
                throws XPathFunctionException
Groups item of a list.

Specified by:
evaluate in interface XPathFunction
context - The context when evaluating this function : XPath variables, current node, etc.
args - The arguments of this function :
  • the first is the list of items to group,
  • the others are the grouping criteria.
A list of list.
XPathFunctionException - When this function fails to be evaluated.
See Also:
XPathFunction.evaluate(org.inria.ns.reflex.xml.xpath.XPathContext, java.util.List)


public boolean isDeferred(int argument)
The first argument is not deferred (evaluated to the stuff to group), others are deferred (evaluated for each item of the stuff to group).

Specified by:
isDeferred in interface DeferrableFunction
argument - The index of the argument.
false if argument=0, true otherwise.
See Also: