gnu.xquery.util

Class OrderedMap

public class OrderedMap extends MethodProc implements CanInline, Inlineable

A procedure used to represent a FLWOR expression with an {@code order by} clause. (ValuesMap is used for FLWOR expression that don't have an {@code order by} clause.) As returned by the parser:
 for $x1 in exp1, $x2 in exp2 where cond order by comparator1 ... return body
 
is represented as
 ordered-map(tuple-sequence, body-function,
             comparator-function1, flags1, collation1, ...)
 
Here tuple-sequence is an expression that returns a sequence of tuples, which are currently implemnted as Java Object[] arrays. After inlining we get:
 ordered-map(tuple-sequence.
   OrderedTuples.make$V(body-function,
     new Object[]{comparator-function1, flags1, collation1, ...}))
 
A future optimization would be to create an instance of a new sub-class of OrderedTuples. Then the body-function and comparator-functions could be compiled as methods to that class. That wins especially if it saves us having to create extra frame classes.
Field Summary
static OrderedMaporderedMap
Method Summary
voidapply(CallContext ctx)
voidcompile(ApplyExp exp, Compilation comp, Target target)
TypegetReturnType(Expression[] args)
Expressioninline(ApplyExp exp, ExpWalker walker)
static Object[]makeTuple$V(Object[] values)

Field Detail

orderedMap

public static final OrderedMap orderedMap

Method Detail

apply

public void apply(CallContext ctx)

compile

public void compile(ApplyExp exp, Compilation comp, Target target)

getReturnType

public Type getReturnType(Expression[] args)

inline

public Expression inline(ApplyExp exp, ExpWalker walker)

makeTuple$V

public static Object[] makeTuple$V(Object[] values)