MATSIM
WithinDayQSimFactory.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * WithinDayQSimFactory.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2010 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.withinday.mobsim;
22 
23 import jakarta.inject.Inject;
24 
25 import org.apache.logging.log4j.LogManager;
26 import org.apache.logging.log4j.Logger;
27 import org.matsim.api.core.v01.Scenario;
29 import org.matsim.core.config.Config;
34 
35 import com.google.inject.Provider;
36 
37 public class WithinDayQSimFactory implements Provider<Mobsim> {
38 
39  private static final Logger log = LogManager.getLogger(WithinDayQSimFactory.class);
40 
41  private final Scenario scenario;
46 
47  @Inject
48  WithinDayQSimFactory(Scenario scenario, EventsManager eventsManager, WithinDayEngine withinDayEngine,
50  this.scenario = scenario;
51  this.eventsManager = eventsManager;
52  this.withinDayEngine = withinDayEngine;
53  this.fixedOrderSimulationListener = fixedOrderSimulationListener;
54  this.withinDayTravelTime = WithinDayTravelTime;
55  }
56 
57  @Override
58  public Mobsim get() {
59  Config config = scenario.getConfig();
60 
61  log.info("Adding WithinDayEngine to Mobsim.");
62  return new QSimBuilder(config) //
63  .useDefaults() //
65  new WithinDayQSimModule(withinDayEngine, fixedOrderSimulationListener, withinDayTravelTime)) //
67  .build(scenario, eventsManager);
68  }
69 }
final FixedOrderSimulationListener fixedOrderSimulationListener
QSimBuilder configureQSimComponents(QSimComponentsConfigurator configurator)
QSimBuilder addQSimModule(AbstractQSimModule module)
static void configureComponents(QSimComponentsConfig components)
QSim build(Scenario scenario, EventsManager eventsManager)