@Test public void matchArgumentCount2() { FormulaFunction function = mock(FormulaFunction.class); when(function.isVarArgs()).thenReturn(true); when(function.getArgumentTypes()).thenReturn(Arrays.<Class<?>>asList(Number.class, String.class)); assertThat(FormulaFunctions.matchArgumentCount(0, function), equalTo(false)); assertThat(FormulaFunctions.matchArgumentCount(1, function), equalTo(true)); assertThat(FormulaFunctions.matchArgumentCount(2, function), equalTo(true)); assertThat(FormulaFunctions.matchArgumentCount(3, function), equalTo(true)); assertThat(FormulaFunctions.matchArgumentCount(10, function), equalTo(true)); }
public static boolean matchArgumentCount(int nArguments, FormulaFunction function) { if (!function.isVarArgs() && (function.getArgumentTypes().size() != nArguments)) { return false; } if (function.isVarArgs() && ((function.getArgumentTypes().size() - 1) > nArguments)) { return false; } return true; }
FormulaFunctions { public static boolean matchArgumentCount(int nArguments, FormulaFunction function) { if (!function.isVarArgs() && (function.getArgumentTypes().size() != nArguments)) { return false; } if (function.isVarArgs() && ((function.getArgumentTypes().size() - 1) > nArguments)) { return false; } return true; } }
FormulaFunctions { public static boolean matchArgumentCount(int nArguments, FormulaFunction function) { if (!function.isVarArgs() && (function.getArgumentTypes().size() != nArguments)) { return false; } if (function.isVarArgs() && ((function.getArgumentTypes().size() - 1) > nArguments)) { return false; } return true; }  }
FormulaFunctions { public static boolean matchArgumentCount(int nArguments, FormulaFunction function) { if (!function.isVarArgs() && (function.getArgumentTypes().size() != nArguments)) { return false; } if (function.isVarArgs() && ((function.getArgumentTypes().size() - 1) > nArguments)) { return false; } return true; }  static boolean matchArgumentTypes(List<Object> arguments, FormulaFunction function); static boolean matchArgumentTypes(List<Object> arguments, FormulaFunction function, boolean allowNull); static boolean matchArgumentCount(int nArguments, FormulaFunction function); static FormulaFunction findFirstMatch(List<Object> arguments, Collection<FormulaFunction> formulaFunctions); static Collection<FormulaFunction> findArgTypeMatch(List<Class<?>> argTypes, Collection<FormulaFunction> formulaFunctions); static String formatSignature(FormulaFunction function); static String format(String function, List<String> args); }
FormulaFunctions { public static boolean matchArgumentCount(int nArguments, FormulaFunction function) { if (!function.isVarArgs() && (function.getArgumentTypes().size() != nArguments)) { return false; } if (function.isVarArgs() && ((function.getArgumentTypes().size() - 1) > nArguments)) { return false; } return true; }  static boolean matchArgumentTypes(List<Object> arguments, FormulaFunction function); static boolean matchArgumentTypes(List<Object> arguments, FormulaFunction function, boolean allowNull); static boolean matchArgumentCount(int nArguments, FormulaFunction function); static FormulaFunction findFirstMatch(List<Object> arguments, Collection<FormulaFunction> formulaFunctions); static Collection<FormulaFunction> findArgTypeMatch(List<Class<?>> argTypes, Collection<FormulaFunction> formulaFunctions); static String formatSignature(FormulaFunction function); static String format(String function, List<String> args);  }