@Test(expected=RhsFunctionException.class) public void testCheckAllArgumentsAreNumericThrowsExceptionWhenConstraintViolated() throws Exception { RhsFunctions.checkAllArgumentsAreNumeric("test", Symbols.asList(syms, 1, 2, 3.14, 6, "nan", 99)); }
public static void checkAllArgumentsAreNumeric(String name, List<Symbol> arguments) throws RhsFunctionException { for (Symbol arg : arguments) { if(arg.asInteger() == null && arg.asDouble() == null) { throw new RhsFunctionException("non-number (" + arg + ") passed to '" + name + "' function"); } } }
RhsFunctions { public static void checkAllArgumentsAreNumeric(String name, List<Symbol> arguments) throws RhsFunctionException { for (Symbol arg : arguments) { if(arg.asInteger() == null && arg.asDouble() == null) { throw new RhsFunctionException("non-number (" + arg + ") passed to '" + name + "' function"); } } } }
RhsFunctions { public static void checkAllArgumentsAreNumeric(String name, List<Symbol> arguments) throws RhsFunctionException { for (Symbol arg : arguments) { if(arg.asInteger() == null && arg.asDouble() == null) { throw new RhsFunctionException("non-number (" + arg + ") passed to '" + name + "' function"); } } } private  RhsFunctions(); }
RhsFunctions { public static void checkAllArgumentsAreNumeric(String name, List<Symbol> arguments) throws RhsFunctionException { for (Symbol arg : arguments) { if(arg.asInteger() == null && arg.asDouble() == null) { throw new RhsFunctionException("non-number (" + arg + ") passed to '" + name + "' function"); } } } private  RhsFunctions(); static void checkArgumentCount(RhsFunctionHandler handler, 
                                          List<Symbol> arguments); static void checkArgumentCount(String name, List<Symbol> arguments, int min, int max); static void checkAllArgumentsAreNumeric(String name, List<Symbol> arguments); }
RhsFunctions { public static void checkAllArgumentsAreNumeric(String name, List<Symbol> arguments) throws RhsFunctionException { for (Symbol arg : arguments) { if(arg.asInteger() == null && arg.asDouble() == null) { throw new RhsFunctionException("non-number (" + arg + ") passed to '" + name + "' function"); } } } private  RhsFunctions(); static void checkArgumentCount(RhsFunctionHandler handler, 
                                          List<Symbol> arguments); static void checkArgumentCount(String name, List<Symbol> arguments, int min, int max); static void checkAllArgumentsAreNumeric(String name, List<Symbol> arguments);  }