@Test public void testParseDialog() throws Exception { assertThrows(ConfigurationErrorException.class, () -> FunctionFactory.parse(new ConfigThingy("DIALOG", "\"abc\""), funcLib, dialogLib, context)); assertThrows(ConfigurationErrorException.class, () -> FunctionFactory.parse(new ConfigThingy("DIALOG", "\"abc\" \"abc\""), funcLib, dialogLib, context)); assertThrows(ConfigurationErrorException.class, () -> FunctionFactory.parse(new ConfigThingy("DIALOG", "\"dialog\" \"abc\""), funcLib, dialogLib, null)); }
private static Function parseDIALOG(ConfigThingy conf, DialogLibrary dialogLib, Map<Object, Object> context) { if (conf.count() != 2) throw new ConfigurationErrorException(L.m( "Funktion vom Typ \"DIALOG\" erfordert genau 2 Parameter, nicht %1", conf.count())); String dialogName; String dataName; try { dialogName = conf.getFirstChild().toString(); dataName = conf.getLastChild().toString(); } catch (NodeNotFoundException x) { dialogName = null; dataName = null; } Dialog dialog = dialogLib.get(dialogName); if (dialog == null) throw new ConfigurationErrorException(L.m( "Dialog \"%1\" ist nicht definiert, aber wird in DIALOG-Funktion verwendet", dialogName)); if (context == null) throw new ConfigurationErrorException( L.m("DIALOG-Funktion ist kontextabhängig und kann deshalb hier nicht verwendet werden.")); return new DialogFunction(dialogName, dialog, dataName, context); }
FunctionFactory { private static Function parseDIALOG(ConfigThingy conf, DialogLibrary dialogLib, Map<Object, Object> context) { if (conf.count() != 2) throw new ConfigurationErrorException(L.m( "Funktion vom Typ \"DIALOG\" erfordert genau 2 Parameter, nicht %1", conf.count())); String dialogName; String dataName; try { dialogName = conf.getFirstChild().toString(); dataName = conf.getLastChild().toString(); } catch (NodeNotFoundException x) { dialogName = null; dataName = null; } Dialog dialog = dialogLib.get(dialogName); if (dialog == null) throw new ConfigurationErrorException(L.m( "Dialog \"%1\" ist nicht definiert, aber wird in DIALOG-Funktion verwendet", dialogName)); if (context == null) throw new ConfigurationErrorException( L.m("DIALOG-Funktion ist kontextabhängig und kann deshalb hier nicht verwendet werden.")); return new DialogFunction(dialogName, dialog, dataName, context); } }
FunctionFactory { private static Function parseDIALOG(ConfigThingy conf, DialogLibrary dialogLib, Map<Object, Object> context) { if (conf.count() != 2) throw new ConfigurationErrorException(L.m( "Funktion vom Typ \"DIALOG\" erfordert genau 2 Parameter, nicht %1", conf.count())); String dialogName; String dataName; try { dialogName = conf.getFirstChild().toString(); dataName = conf.getLastChild().toString(); } catch (NodeNotFoundException x) { dialogName = null; dataName = null; } Dialog dialog = dialogLib.get(dialogName); if (dialog == null) throw new ConfigurationErrorException(L.m( "Dialog \"%1\" ist nicht definiert, aber wird in DIALOG-Funktion verwendet", dialogName)); if (context == null) throw new ConfigurationErrorException( L.m("DIALOG-Funktion ist kontextabhängig und kann deshalb hier nicht verwendet werden.")); return new DialogFunction(dialogName, dialog, dataName, context); } private  FunctionFactory(); }
FunctionFactory { private static Function parseDIALOG(ConfigThingy conf, DialogLibrary dialogLib, Map<Object, Object> context) { if (conf.count() != 2) throw new ConfigurationErrorException(L.m( "Funktion vom Typ \"DIALOG\" erfordert genau 2 Parameter, nicht %1", conf.count())); String dialogName; String dataName; try { dialogName = conf.getFirstChild().toString(); dataName = conf.getLastChild().toString(); } catch (NodeNotFoundException x) { dialogName = null; dataName = null; } Dialog dialog = dialogLib.get(dialogName); if (dialog == null) throw new ConfigurationErrorException(L.m( "Dialog \"%1\" ist nicht definiert, aber wird in DIALOG-Funktion verwendet", dialogName)); if (context == null) throw new ConfigurationErrorException( L.m("DIALOG-Funktion ist kontextabhängig und kann deshalb hier nicht verwendet werden.")); return new DialogFunction(dialogName, dialog, dataName, context); } private  FunctionFactory(); static Function alwaysTrueFunction(); static Function parseGrandchildren(ConfigThingy conf,
      FunctionLibrary funcLib, DialogLibrary dialogLib, Map<Object, Object> context); static Function parseChildren(ConfigThingy conf, FunctionLibrary funcLib,
      DialogLibrary dialogLib, Map<Object, Object> context); static Function parse(ConfigThingy conf, FunctionLibrary funcLib,
      DialogLibrary dialogLib, Map<Object, Object> context); static FunctionLibrary parseFunctions(ConfigThingy conf,
      DialogLibrary dialogLib, Map<Object, Object> context, FunctionLibrary baselib); static FunctionLibrary parseFunctions(FunctionLibrary funcs,
      ConfigThingy conf, String section, DialogLibrary dialogLib,
      Map<Object, Object> context); static Map<String, Function> parseTrafos(ConfigThingy trafoConf, String nodeName, FunctionLibrary funcLib, DialogLibrary dialogLib,
      Map<Object, Object> context); }
FunctionFactory { private static Function parseDIALOG(ConfigThingy conf, DialogLibrary dialogLib, Map<Object, Object> context) { if (conf.count() != 2) throw new ConfigurationErrorException(L.m( "Funktion vom Typ \"DIALOG\" erfordert genau 2 Parameter, nicht %1", conf.count())); String dialogName; String dataName; try { dialogName = conf.getFirstChild().toString(); dataName = conf.getLastChild().toString(); } catch (NodeNotFoundException x) { dialogName = null; dataName = null; } Dialog dialog = dialogLib.get(dialogName); if (dialog == null) throw new ConfigurationErrorException(L.m( "Dialog \"%1\" ist nicht definiert, aber wird in DIALOG-Funktion verwendet", dialogName)); if (context == null) throw new ConfigurationErrorException( L.m("DIALOG-Funktion ist kontextabhängig und kann deshalb hier nicht verwendet werden.")); return new DialogFunction(dialogName, dialog, dataName, context); } private  FunctionFactory(); static Function alwaysTrueFunction(); static Function parseGrandchildren(ConfigThingy conf,
      FunctionLibrary funcLib, DialogLibrary dialogLib, Map<Object, Object> context); static Function parseChildren(ConfigThingy conf, FunctionLibrary funcLib,
      DialogLibrary dialogLib, Map<Object, Object> context); static Function parse(ConfigThingy conf, FunctionLibrary funcLib,
      DialogLibrary dialogLib, Map<Object, Object> context); static FunctionLibrary parseFunctions(ConfigThingy conf,
      DialogLibrary dialogLib, Map<Object, Object> context, FunctionLibrary baselib); static FunctionLibrary parseFunctions(FunctionLibrary funcs,
      ConfigThingy conf, String section, DialogLibrary dialogLib,
      Map<Object, Object> context); static Map<String, Function> parseTrafos(ConfigThingy trafoConf, String nodeName, FunctionLibrary funcLib, DialogLibrary dialogLib,
      Map<Object, Object> context);  }