MATSIM
CountsHtmlAndGraphsWriter.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * CountsGraphWriter.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.algorithms;
22 
23 import org.apache.logging.log4j.LogManager;
24 import org.apache.logging.log4j.Logger;
29 
30 import java.io.File;
31 import java.util.List;
32 import java.util.Vector;
33 
35 
36  private String iterationPath;
37  private List<CountSimComparison> countSimComparisons;
38  private int iteration;
40  private List<CountsGraphsCreator> graphsCreators;
41 
42  private static final Logger log = LogManager.getLogger(CountsHtmlAndGraphsWriter.class);
43 
44  public CountsHtmlAndGraphsWriter(final String iterationPath, final List<CountSimComparison> countSimComparisons, final int iteration) {
45  this.iterationPath = iterationPath + "/graphs/";
46  this.countSimComparisons = countSimComparisons;
47  this.iteration = iteration;
48  this.outputDelegate = new OutputDelegate(this.iterationPath);
49  new File(this.iterationPath).mkdir();
50  this.graphsCreators=new Vector<CountsGraphsCreator>();
51  }
52 
54  return this.outputDelegate;
55  }
56 
57  public void addGraphsCreator(final CountsGraphsCreator graphsCreator) {
58  this.graphsCreators.add(graphsCreator);
59  }
60 
61  public void createHtmlAndGraphs() {
62  log.info("Creating graphs");
63  for (CountsGraphsCreator cgc : this.graphsCreators) {
64  List<CountsGraph> graphs = cgc.createGraphs(this.countSimComparisons, this.iteration);
65  this.outputDelegate.addSection(cgc.getSection());
66  for (CountsGraph cg : graphs) {
67  this.outputDelegate.addCountsGraph(cg);
68  }
69  }
70  this.outputDelegate.outputHtml();
71  }
72 }
void addGraphsCreator(final CountsGraphsCreator graphsCreator)
CountsHtmlAndGraphsWriter(final String iterationPath, final List< CountSimComparison > countSimComparisons, final int iteration)