1 package net.sf.saxon.expr; 2 import net.sf.saxon.om.Item; 3 import net.sf.saxon.om.NamePool; 4 import net.sf.saxon.om.SequenceIterator; 5 import net.sf.saxon.om.ValueRepresentation; 6 import net.sf.saxon.trans.XPathException; 7 import net.sf.saxon.type.AnyItemType; 8 import net.sf.saxon.type.ItemType; 9 import net.sf.saxon.value.Value; 10 11 import java.io.PrintStream ; 12 13 21 22 public class SuppliedParameterReference extends ComputedExpression { 23 24 int slotNumber; 25 26 30 31 public SuppliedParameterReference(int slot) { 32 slotNumber = slot; 33 } 34 35 38 39 public Expression simplify(StaticContext env) { 40 return this; 41 } 42 43 public Expression typeCheck(StaticContext env, ItemType contextItemType) throws XPathException { 44 return this; 45 } 46 47 public Expression optimize(Optimizer opt, StaticContext env, ItemType contextItemType) throws XPathException { 48 return this; 49 } 50 51 56 57 public ItemType getItemType() { 58 return AnyItemType.getInstance(); 59 } 60 61 66 67 public int computeCardinality() { 68 return StaticProperty.ALLOWS_ZERO_OR_MORE; 69 } 70 71 76 77 public boolean equals(Object other) { 78 return this==other; 79 } 80 81 87 88 public SequenceIterator iterate(XPathContext c) throws XPathException { 89 return Value.getIterator(c.evaluateLocalVariable(slotNumber)); 90 } 91 92 public Item evaluateItem(XPathContext c) throws XPathException { 93 ValueRepresentation actual = c.evaluateLocalVariable(slotNumber); 94 return Value.asItem(actual, c); 95 } 96 97 100 101 public void display(int level, NamePool pool, PrintStream out) { 102 out.println(ExpressionTool.indent(level) + "$#" + slotNumber); 103 } 104 } 105 106 | Popular Tags |