public final void closeStreaming() { // if ((this.population instanceof Population) && (((Population) this.population).isStreaming())) { // if ( this.population instanceof StreamingPopulationReader.StreamingPopulation ) { if (matsimWriter.getWriter() != null) { writeEndPlans(); } else { log.error("Cannot close streaming. File is not open."); } // } else { // log.error("Cannot close streaming. Streaming must be activated in the Population."); // } }
@Override public final void run(final Person person) { writePerson(person); }
public final void startStreaming(final String filename) { // if ((this.population instanceof Population) && (((Population) this.population).isStreaming())) { // if ( this.population instanceof StreamingPopulationReader.StreamingPopulation ) { // write the file head if it is used with streaming. writeStartPlans(filename); // } else { // log.error("Cannot start streaming. Streaming must be activated in the Population."); // } }
try { writer = new StreamingPopulationWriter(null, samplesize); writer.startStreaming(outputPopulationFile.getAbsolutePath()); final PersonAlgorithm algo = writer; } finally { if (writer != null) { writer.closeStreaming();
/** Starts the assignment of links to activities. * * @param args command-line arguments */ public void run(final String[] args) { parseArguments(args); this.config = ConfigUtils.loadConfig(this.configfile); MatsimRandom.reset(this.config.global().getRandomSeed()); MutableScenario scenario = ScenarioUtils.createMutableScenario(this.config); new MatsimNetworkReader(scenario.getNetwork()).readFile(this.config.network().getInputFile()); this.config = scenario.getConfig(); StreamingPopulationReader reader = new StreamingPopulationReader( scenario ) ; final StreamingPopulationWriter plansWriter = new StreamingPopulationWriter(); plansWriter.startStreaming(this.plansfile); reader.addAlgorithm(new org.matsim.core.population.algorithms.XY2Links(scenario)); reader.addAlgorithm(plansWriter); reader.readFile(this.config.plans().getInputFile()); PopulationUtils.printPlansCount(reader) ; plansWriter.closeStreaming(); System.out.println("done."); }
final StreamingPopulationWriter plansWriter = new StreamingPopulationWriter(); Gbl.assertNotNull(this.plansfile); plansWriter.startStreaming(this.plansfile); final FreespeedTravelTimeAndDisutility timeCostCalc = new FreespeedTravelTimeAndDisutility(config.planCalcScore()); com.google.inject.Injector injector = Injector.createInjector(scenario.getConfig(), new AbstractModule() { reader.readFile(this.config.plans().getInputFile()); PopulationUtils.printPlansCount(reader) ; plansWriter.closeStreaming();