1 61 62 63 package org.jaxen.function; 64 65 import java.util.List ; 66 67 import org.jaxen.Context; 68 import org.jaxen.Function; 69 import org.jaxen.FunctionCallException; 70 import org.jaxen.Navigator; 71 72 95 public class CeilingFunction implements Function 96 { 97 98 101 public CeilingFunction() {} 102 103 115 public Object call(Context context, 116 List args) throws FunctionCallException 117 { 118 if (args.size() == 1) 119 { 120 return evaluate( args.get(0), 121 context.getNavigator() ); 122 } 123 124 throw new FunctionCallException("ceiling() requires one argument."); 125 } 126 127 137 public static Double evaluate(Object obj, 138 Navigator nav) 139 { 140 Double value = NumberFunction.evaluate( obj, 141 nav ); 142 143 return new Double ( Math.ceil( value.doubleValue() ) ); 144 } 145 } 146 | Popular Tags |