MATSIM
PopulationModule.java
Go to the documentation of this file.
1 
2 /* *********************************************************************** *
3  * project: org.matsim.*
4  * PopulationModule.java
5  * *
6  * *********************************************************************** *
7  * *
8  * copyright : (C) 2019 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  package org.matsim.core.mobsim.qsim;
23 
24 import com.google.inject.Provides;
25 import com.google.inject.Singleton;
35 
36 public class PopulationModule extends AbstractQSimModule {
37  public final static String COMPONENT_NAME = "PopulationAgentSource";
38 
39  @Override
40  protected void configureQSim() {
41  bind(PopulationAgentSource.class).asEagerSingleton();
42  addQSimComponentBinding( COMPONENT_NAME ).to( PopulationAgentSource.class );
43  }
44 
45  @Provides
46  @Singleton
47  AgentFactory provideAgentFactory(TransitConfigGroup config, Netsim simulation, TimeInterpretation timeInterpretation) {
48  if (config.isUseTransit()) {
49  return new TransitAgentFactory(simulation, timeInterpretation);
50  } else {
51  return new DefaultAgentFactory(simulation, timeInterpretation);
52  }
53  }
54 
55  @Provides
56  @Singleton
57  QVehicleFactory provideQVehicleFactory( ) {
58  return QVehicleImpl::new;
59  }
60 }
final LinkedBindingBuilder< QSimComponent > addQSimComponentBinding(Annotation annotation)