1 package com.icl.saxon.functions; 2 import com.icl.saxon.*; 3 import com.icl.saxon.expr.*; 4 5 import java.util.*; 6 7 8 9 public class Last extends Function { 10 11 14 15 public String getName() { 16 return "last"; 17 }; 18 19 23 24 public int getDataType() { 25 return Value.NUMBER; 26 } 27 28 31 32 public Expression simplify() throws XPathException { 33 checkArgumentCount(0, 0); 34 return this; 35 } 36 37 40 41 public double evaluateAsNumber(Context c) throws XPathException { 42 return (double)c.getLast(); 43 } 44 45 48 49 public Value evaluate(Context c) throws XPathException { 50 return new NumericValue(evaluateAsNumber(c)); 51 } 52 53 56 57 public int getDependencies() { 58 return Context.LAST; 59 } 60 61 64 65 public Expression reduce(int dep, Context c) throws XPathException { 66 if ((dep & Context.LAST) != 0) { 67 return new NumericValue(c.getLast()); 68 } else { 69 return this; 70 } 71 } 72 73 74 } 75 76 77 78 | Popular Tags |