MATSIM
PlansReplanningImpl.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * PlansReplanner.java.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.core.controler.corelisteners;
22 
29 
30 import com.google.inject.Inject;
31 import com.google.inject.Singleton;
32 
33 import jakarta.inject.Provider;
34 
43 @Singleton
44 final class PlansReplanningImpl implements PlansReplanning, ReplanningListener {
45  private final Provider<ReplanningContext> replanningContextProvider;
46  private final Population population;
47  private final StrategyManager strategyManager;
48  private final ConflictManager conflictManager;
49 
50  @Inject
51  PlansReplanningImpl(StrategyManager strategyManager, ConflictManager conflictManager, Population pop,
52  Provider<ReplanningContext> replanningContextProvider) {
53  this.population = pop;
54  this.strategyManager = strategyManager;
55  this.conflictManager = conflictManager;
56  this.replanningContextProvider = replanningContextProvider;
57  }
58 
59  @Override
60  public void notifyReplanning(final ReplanningEvent event) {
61  conflictManager.initializeReplanning(population);
62  strategyManager.run(population, event.getIteration(), replanningContextProvider.get());
63  conflictManager.run(population, event.getIteration());
64  }
65 }