public String serialize() { try { ModelReader<SDRun> loader = new ModelReader(SDRun.class); return loader.marshall(this); } catch (Exception e) { throw new RuntimeException(e); } }
protected static SDRun deserialize(String xml, Long seed) { ModelReader<SDRun> loader = new ModelReader(SDRun.class); HashMap<String, String> overrides = null; if (seed != null) { overrides = new HashMap<>(); overrides.put("SDRun.simulationSeed", "" + seed); } log.info("Loading model from xml with seed {}", seed); try { return loader.unmarshall(xml, overrides); } catch (Exception e) { throw new RuntimeException(e); } }
protected static SDRun deserialize(File filename, Long seed) { ModelReader<SDRun> loader = new ModelReader(SDRun.class); HashMap<String, String> overrides = null; if (seed != null) { overrides = new HashMap<>(); overrides.put("SDRun.simulationSeed", "" + seed); } log.info("Loading model from \"{}\" with seed {}", filename, seed); try { return loader.unmarshall(filename, overrides); } catch (ModelReader.XMLUnmarshallingFailure e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }