1 package net.sf.saxon.functions; 2 import net.sf.saxon.expr.Expression; 3 import net.sf.saxon.expr.ExpressionTool; 4 import net.sf.saxon.expr.StaticContext; 5 import net.sf.saxon.expr.Optimizer; 6 import net.sf.saxon.trans.XPathException; 7 import net.sf.saxon.type.ItemType; 8 9 12 13 public class Unordered extends CompileTimeFunction { 14 15 public Expression typeCheck(StaticContext env, ItemType contextItemType) throws XPathException { 16 Expression exp = super.typeCheck(env, contextItemType); 17 if (exp instanceof Unordered) { 18 Optimizer opt = env.getConfiguration().getOptimizer(); 19 return ExpressionTool.unsorted(opt, ((Unordered)exp).argument[0], true); 20 } 21 return exp; 22 } 23 24 public Expression optimizer(Optimizer opt, StaticContext env, ItemType contextItemType) throws XPathException { 25 Expression exp = super.optimize(opt, env, contextItemType); 26 if (exp instanceof Unordered) { 27 return ExpressionTool.unsorted(opt, ((Unordered)exp).argument[0], true); 28 } 29 return exp; 30 } 31 32 35 36 public Expression preEvaluate(StaticContext env) throws XPathException { 37 return argument[0]; 38 } 39 } 40 41 42 43 44 45 | Popular Tags |