1 16 17 package org.apache.taglibs.standard.lang.jpath.expression; 18 19 import javax.servlet.jsp.PageContext ; 20 21 import org.apache.taglibs.standard.lang.jpath.adapter.IterationContext; 22 23 30 public class LastFunction extends SimpleNode { 31 32 39 public LastFunction(int id) { 40 super(id); 41 } 42 43 51 public LastFunction(Parser p, int id) { 52 super(p, id); 53 } 54 55 65 public String toNormalizedString() { 66 67 String normalized = ""; 68 69 normalized = "last()"; 70 71 return normalized; 72 } 73 74 91 public Object evaluate(PageContext pageContext, IterationContext icontext) 92 throws EvaluationException { 93 94 if (icontext == null) { 95 throw new EvaluationException(this, 96 "The last() function can " 97 + "only be used in the context of a predicate"); 98 } 99 100 return new Double (icontext.getLast()); 101 } 102 } 103 | Popular Tags |