MATSIM
WithinDayReplanner.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * WithinDayReplanner.java
4  * *
5  * *********************************************************************** *
6  * *
7  * copyright : (C) 2008 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.replanning.replanners.interfaces;
22 
23 import org.matsim.api.core.v01.Id;
24 import org.matsim.api.core.v01.Scenario;
29 
30 /*
31  * Each WithinDayReplanner needs one or more AgentsToReplanIdentifier
32  * which identifies Agents that need a Replanning of their scheduled
33  * Plans.
34  */
38 public abstract class WithinDayReplanner<T extends AgentSelector> {
39 
40  protected final Id<WithinDayReplanner> id;
41  protected final Scenario scenario;
43 
45 
46  public WithinDayReplanner(Id<WithinDayReplanner> id, Scenario scenario, ActivityEndRescheduler activityEndRescheduler) {
47  this.id = id;
48  this.scenario = scenario;
49  this.internalInterface = activityEndRescheduler;
50  }
51 
52  public abstract boolean doReplanning(MobsimAgent withinDayAgent);
53 
54  public final Id<WithinDayReplanner> getId() {
55  return this.id;
56  }
57 
58  public final OptionalTime getTime() {
59  return this.time;
60  }
61 
62  public final void setTime(double time) {
63  this.time = OptionalTime.defined(time);
64  }
65 
66  public void reset() {
67  this.time = OptionalTime.undefined();
68  }
69 
70  @Override
71  public boolean equals(Object o) {
72  if (o instanceof WithinDayReplanner) {
74  return replanner.getId().equals(this.getId());
75  }
76  return false;
77  }
78 
79  @Override
80  public int hashCode() {
81  return getId().hashCode();
82  }
83 }
abstract boolean doReplanning(MobsimAgent withinDayAgent)
WithinDayReplanner(Id< WithinDayReplanner > id, Scenario scenario, ActivityEndRescheduler activityEndRescheduler)
static OptionalTime defined(double seconds)