Пример #1
0
  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);
    }
  }
Пример #2
0
  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);
    }
  }