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 92 public class FloorFunction implements Function 93 { 94 95 98 public FloorFunction() {} 99 100 112 public Object call(Context context, 113 List args) throws FunctionCallException 114 { 115 if (args.size() == 1) 116 { 117 return evaluate( args.get(0), 118 context.getNavigator() ); 119 } 120 121 throw new FunctionCallException( "floor() requires one argument." ); 122 } 123 124 134 public static Double evaluate(Object obj, 135 Navigator nav) 136 { 137 Double value = NumberFunction.evaluate( obj, 138 nav ); 139 140 return new Double ( Math.floor( value.doubleValue() ) ); 141 } 142 } 143 144 | Popular Tags |