MATSIM
TransitScheduleWriter.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * TransitScheduleWriter.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2009 by the members listed in the COPYING, *
8  * LICENSE and WARRANTY file. *
9  * email : info at matsim dot org *
10  * *
11  * *********************************************************************** *
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * See also COPYING, LICENSE and WARRANTY file *
18  * *
19  * *********************************************************************** */
20 
21 package org.matsim.pt.transitSchedule.api;
22 
23 import org.apache.logging.log4j.LogManager;
24 import org.apache.logging.log4j.Logger;
26 import org.matsim.core.gbl.Gbl;
31 
32 import java.io.UncheckedIOException;
33 
40 public class TransitScheduleWriter implements MatsimSomeWriter {
41  private static final Logger log = LogManager.getLogger( TransitScheduleWriter.class ) ;
42 
43  private final TransitSchedule schedule;
45 
46  public TransitScheduleWriter(final TransitSchedule schedule) {
47  this( new IdentityTransformation() , schedule );
48  }
49 
51  final CoordinateTransformation transformation,
52  final TransitSchedule schedule) {
53  this.transformation = transformation;
54  this.schedule = schedule;
55  }
56 
65  public void writeFile(final String filename) throws UncheckedIOException {
66  writeFileV2(filename);
67  }
68 
76  public void writeFileV1(final String filename) throws UncheckedIOException {
77  log.info( Gbl.aboutToWrite("transit schedule", filename) ) ;
78  new TransitScheduleWriterV1(this.transformation, this.schedule).write(filename);
79  }
80 
88  public void writeFileV2(final String filename) throws UncheckedIOException {
89  log.info( Gbl.aboutToWrite( "transit schedule" , filename ) ) ;
90  new TransitScheduleWriterV2(this.transformation, this.schedule).write(filename);
91  }
92 }
TransitScheduleWriter(final CoordinateTransformation transformation, final TransitSchedule schedule)
static String aboutToWrite(String what, String filename)
Definition: Gbl.java:254