@Test public void selectFunction() throws Exception { FunctionLibrary funcLib = new FunctionLibrary(); DialogLibrary dialogLib = new DialogLibrary(); HashMap<Object, Object> context = new HashMap<>(); Function f = new SelectFunction( new ConfigThingy("SELECT", "IF(\"true\" THEN \"1\") IF(\"true\" THEN \"2\") ELSE \"3\" ONERROR \"error\""), funcLib, dialogLib, context); assertEquals(0, f.parameters().length); assertEquals("1", f.getString(null)); assertFalse(f.getBoolean(null)); Collection<String> dialogFunctions = new ArrayList<>(); f.getFunctionDialogReferences(dialogFunctions); assertTrue(dialogFunctions.isEmpty()); f = new SelectFunction( new ConfigThingy("SELECT", "IF(\"false\" THEN \"1\") IF(\"true\" THEN \"2\") ELSE \"3\" ONERROR \"error\""), funcLib, dialogLib, context); assertEquals("2", f.getString(null)); f = new SelectFunction( new ConfigThingy("SELECT", "IF(\"false\" THEN \"1\") IF(\"false\" THEN \"2\") ELSE \"3\" ONERROR \"error\""), funcLib, dialogLib, context); assertEquals("3", f.getString(null)); f = new SelectFunction(List.of(new StringLiteralFunction(FunctionLibrary.ERROR))); assertEquals(FunctionLibrary.ERROR, f.getString(null)); SelectFunction sf = new SelectFunction(List.of(new StringLiteralFunction(FunctionLibrary.ERROR))); sf.handleParam(new ConfigThingy("ONERROR", "\"error\""), funcLib, dialogLib, context); assertEquals("error", sf.getString(null)); f = new SelectFunction(Collections.emptyList()); assertEquals(FunctionLibrary.ERROR, f.getString(null)); }
public SelectFunction(Collection<Function> subFunction) { super(subFunction); }
SelectFunction extends MultiFunction { public SelectFunction(Collection<Function> subFunction) { super(subFunction); } }
SelectFunction extends MultiFunction { public SelectFunction(Collection<Function> subFunction) { super(subFunction); } SelectFunction(Collection<Function> subFunction);  SelectFunction(ConfigThingy conf, FunctionLibrary funcLib,
      DialogLibrary dialogLib, Map<Object, Object> context); }
SelectFunction extends MultiFunction { public SelectFunction(Collection<Function> subFunction) { super(subFunction); } SelectFunction(Collection<Function> subFunction);  SelectFunction(ConfigThingy conf, FunctionLibrary funcLib,
      DialogLibrary dialogLib, Map<Object, Object> context); @Override void getFunctionDialogReferences(Collection<String> set); @Override String getString(Values parameters); }
SelectFunction extends MultiFunction { public SelectFunction(Collection<Function> subFunction) { super(subFunction); } SelectFunction(Collection<Function> subFunction);  SelectFunction(ConfigThingy conf, FunctionLibrary funcLib,
      DialogLibrary dialogLib, Map<Object, Object> context); @Override void getFunctionDialogReferences(Collection<String> set); @Override String getString(Values parameters);  }