MATSIM
ControlerDefaultsModule.java
Go to the documentation of this file.
1 /*
2  * *********************************************************************** *
3  * * project: org.matsim.*
4  * * DefaultControlerModules.java
5  * * *
6  * * *********************************************************************** *
7  * * *
8  * * copyright : (C) 2014 by the members listed in the COPYING, *
9  * * LICENSE and WARRANTY file. *
10  * * email : info at matsim dot org *
11  * * *
12  * * *********************************************************************** *
13  * * *
14  * * This program is free software; you can redistribute it and/or modify *
15  * * it under the terms of the GNU General Public License as published by *
16  * * the Free Software Foundation; either version 2 of the License, or *
17  * * (at your option) any later version. *
18  * * See also COPYING, LICENSE and WARRANTY file *
19  * * *
20  * * ***********************************************************************
21  */
22 
23 package org.matsim.core.controler;
24 
25 import com.google.inject.Inject;
49 
50 import javax.imageio.ImageIO;
51 import java.io.File;
52 
53 public final class ControlerDefaultsModule extends AbstractModule {
54 
55  @Override
56  public void install() {
65  if (getConfig().replanningAnnealer().isActivateAnnealingModule()) {
67  }
68 
69  // I think that the ones coming here are all for analysis only, and thus not central to the iterations. kai, apr'18
70  install(new LinkStatsModule());
73  install(new LegTimesModule());
76  install(new ModeStatsModule());
77  install(new CountsModule());
82 
83  // Comment by Tarek Chouaki.
84  // To make sure the cache files used under ChartUtils are located in tmp folder in the output directory
85  // The ImageIO.setCacheDirectory method checks if the provided directory exists so it needs to be created first
86  // Maybe not the best place to but this but since ChartUtils is used by many modules, including default ones,
87  // the cache needs to be always set correctly.
88  addControlerListenerBinding().toInstance(new StartupListener() {
89 
90  @Override
91  public void notifyStartup(StartupEvent event) {
92  ImageIO.setCacheDirectory(new File(event.getServices().getControlerIO().getTempPath()));
93  }
94  });
95 
96  /* Comment by kai (mz thinks it is not helpful): The framework eventually calls the above method, which calls the include
97  * methods , which (fairly quickly) call their own install methods, etc. Eventually, everything is resolved down to the
98  * "bindTo..." methods, which are the leaves.
99  */
100 
101  }
102 }
OutputDirectoryHierarchy getControlerIO()
final LinkedBindingBuilder< ControlerListener > addControlerListenerBinding()