MATSIM
CountsWriter.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * CountsWriter.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2007 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.counts;
22 
27 
28 import java.io.IOException;
29 
34 public class CountsWriter extends MatsimXmlWriter implements MatsimWriter {
35 
37  private final Counts counts;
38 
39  public CountsWriter(final Counts counts) {
40  this(new IdentityTransformation(), counts);
41  }
42 
43  public CountsWriter(
44  final CoordinateTransformation ct,
45  final Counts counts) {
46  this.ct = ct;
47  this.counts = counts;
48  }
49 
50  @Override
51  public final void write(final String filename) {
52  try {
53  if (System.getProperty("MATSIM_COUNTS_VERSION", "").equalsIgnoreCase("1"))
54  new CountsWriterV1(ct, counts).write(filename);
55  else
56  new CountsWriterV2(ct, counts).write(filename);
57  } catch (IOException e) {
58  throw new RuntimeException(e);
59  }
60  }
61 
62  @Override
63  public final String toString() {
64  return super.toString();
65  }
66 }
CountsWriter(final CoordinateTransformation ct, final Counts counts)
final void write(final String filename)
CountsWriter(final Counts counts)
final CoordinateTransformation ct