/** * Writes all plans to the file. */ @Override public final void write(final String filename) { try { this.openFile(filename); this.handler.writeHeaderAndStartElement(this.writer); this.handler.startPlans(this.population, this.writer); this.handler.writeSeparator(this.writer); this.writePersons(); this.handler.endPlans(this.writer); log.info("Population written to: " + filename); } catch (IOException e) { throw new UncheckedIOException(e); } finally { this.close(); counter.printCounter(); counter.reset(); } }
private final void writePerson(final Person person) { try { if ((this.write_person_fraction < 1.0) && (MatsimRandom.getRandom().nextDouble() >= this.write_person_fraction)) { return; } this.handler.writePerson(person, this.writer); counter.incCounter(); } catch (IOException e) { throw new UncheckedIOException(e); } }
try { matsimWriter.openHere(filename); this.handler.writeHeaderAndStartElement(matsimWriter.getWriter()); this.handler.startPlans(fakepop, matsimWriter.getWriter()); this.handler.writeSeparator(matsimWriter.getWriter()); } catch (IOException e) { throw new UncheckedIOException(e);
public final void writeEndPlans() { try { this.handler.endPlans(matsimWriter.getWriter()); } catch (IOException e) { throw new UncheckedIOException(e); } matsimWriter.closeHere(); }
/** * Writes all plans to the output stream and closes it. * */ public final void write(OutputStream outputStream) { try { this.openOutputStream(outputStream); this.handler.writeHeaderAndStartElement(this.writer); this.handler.startPlans(this.population, this.writer); this.handler.writeSeparator(this.writer); this.writePersons(); this.handler.endPlans(this.writer); } catch (IOException e) { throw new UncheckedIOException(e); } finally { this.close(); counter.printCounter(); counter.reset(); } }
public final void writePerson(final Person person) { try { if ((this.write_person_fraction < 1.0) && (MatsimRandom.getRandom().nextDouble() >= this.write_person_fraction)) { return; } this.handler.writePerson(person, matsimWriter.getWriter()); counter.incCounter(); } catch (IOException e) { throw new UncheckedIOException(e); } }