@Test public void ifFunction() throws Exception { Function cond1 = new StringLiteralFunction("true"); Function cond2 = new StringLiteralFunction("false"); Function then = new StringLiteralFunction("then"); Function el = new StringLiteralFunction("else"); Function f = new IfFunction(cond1, then, el); assertEquals(0, f.parameters().length); assertEquals("then", f.getString(null)); assertFalse(f.getBoolean(null)); Collection<String> dialogFunctions = new ArrayList<>(); f.getFunctionDialogReferences(dialogFunctions); assertTrue(dialogFunctions.isEmpty()); f = new IfFunction(cond2, then, el); assertEquals("else", f.getString(null)); assertFalse(f.getBoolean(null)); f = new IfFunction(new StringLiteralFunction(FunctionLibrary.ERROR), then, el); assertEquals(FunctionLibrary.ERROR, f.getString(null)); assertFalse(f.getBoolean(null)); }
public IfFunction(Function ifFunction, Function thenFunction, Function elseFunction) { Set<String> myparams = new HashSet<>(); myparams.addAll(Arrays.asList(ifFunction.parameters())); myparams.addAll(Arrays.asList(thenFunction.parameters())); myparams.addAll(Arrays.asList(elseFunction.parameters())); params = myparams.toArray(new String[0]); this.ifFunction = ifFunction; this.thenFunction = thenFunction; this.elseFunction = elseFunction; }
IfFunction implements Function { public IfFunction(Function ifFunction, Function thenFunction, Function elseFunction) { Set<String> myparams = new HashSet<>(); myparams.addAll(Arrays.asList(ifFunction.parameters())); myparams.addAll(Arrays.asList(thenFunction.parameters())); myparams.addAll(Arrays.asList(elseFunction.parameters())); params = myparams.toArray(new String[0]); this.ifFunction = ifFunction; this.thenFunction = thenFunction; this.elseFunction = elseFunction; } }
IfFunction implements Function { public IfFunction(Function ifFunction, Function thenFunction, Function elseFunction) { Set<String> myparams = new HashSet<>(); myparams.addAll(Arrays.asList(ifFunction.parameters())); myparams.addAll(Arrays.asList(thenFunction.parameters())); myparams.addAll(Arrays.asList(elseFunction.parameters())); params = myparams.toArray(new String[0]); this.ifFunction = ifFunction; this.thenFunction = thenFunction; this.elseFunction = elseFunction; } IfFunction(Function ifFunction, Function thenFunction,
      Function elseFunction); }
IfFunction implements Function { public IfFunction(Function ifFunction, Function thenFunction, Function elseFunction) { Set<String> myparams = new HashSet<>(); myparams.addAll(Arrays.asList(ifFunction.parameters())); myparams.addAll(Arrays.asList(thenFunction.parameters())); myparams.addAll(Arrays.asList(elseFunction.parameters())); params = myparams.toArray(new String[0]); this.ifFunction = ifFunction; this.thenFunction = thenFunction; this.elseFunction = elseFunction; } IfFunction(Function ifFunction, Function thenFunction,
      Function elseFunction); @Override String[] parameters(); @Override void getFunctionDialogReferences(Collection<String> set); @Override String getString(Values parameters); @Override boolean getBoolean(Values parameters); }
IfFunction implements Function { public IfFunction(Function ifFunction, Function thenFunction, Function elseFunction) { Set<String> myparams = new HashSet<>(); myparams.addAll(Arrays.asList(ifFunction.parameters())); myparams.addAll(Arrays.asList(thenFunction.parameters())); myparams.addAll(Arrays.asList(elseFunction.parameters())); params = myparams.toArray(new String[0]); this.ifFunction = ifFunction; this.thenFunction = thenFunction; this.elseFunction = elseFunction; } IfFunction(Function ifFunction, Function thenFunction,
      Function elseFunction); @Override String[] parameters(); @Override void getFunctionDialogReferences(Collection<String> set); @Override String getString(Values parameters); @Override boolean getBoolean(Values parameters);  }