MATSIM
MyPlanSelector.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * MyPlansSelector.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 package tutorial.programming.example11PluggablePlanStrategyInCode;
21 
22 import org.apache.log4j.Logger;
25 import org.matsim.api.core.v01.population.HasPlansAndId;
28 import org.matsim.core.replanning.selectors.PlanSelector;
29 
33 class MyPlanSelector implements PlanSelector<Plan, Person>, ActivityEndEventHandler
34 {
35  private static final Logger log = Logger.getLogger(MyPlanSelector.class);
36 
37  @Override
38  public Plan selectPlan(HasPlansAndId<Plan, Person> person) {
39  log.error("calling selectPlan: PesonId: " + person.getId() + " Returning first Plan") ;
40  //returning first plan available. In real live the selection will be more sophisticated
41  return person.getPlans().get(0);
42  }
43 
44  @Override
45  public void handleEvent(ActivityEndEvent event) {
46  //log.error("calling handleEvent for an ActivityEndEvent") ;
47  }
48 
49  @Override
50  public void reset(int iteration) {
51  log.error("calling reset") ;
52  }
53 
54 }