/** Returns the nearest integer to the number. * * @param context the context at the point in the * expression when the function is called * @param args a list with exactly one item which will be converted to a * <code>Double</code> as if by the XPath <code>number()</code> function * * @return a <code>Double</code> containing the integer nearest to * <code>args.get(0)</code> * * @throws FunctionCallException if <code>args</code> has more or less than one item */ public Object call(Context context, List args) throws FunctionCallException { if (args.size() == 1) { return evaluate( args.get(0), context.getNavigator() ); } throw new FunctionCallException( "round() requires one argument." ); }
new RoundFunction() );
"round", new RoundFunction());
"round", new RoundFunction());