MATSIM
MobsimTimer.java
Go to the documentation of this file.
1 /* *********************************************************************** *
2  * project: org.matsim.*
3  * QSimTimer
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 org.matsim.core.mobsim.framework;
21 
22 
23 
27 public class MobsimTimer {
28  private double simStartTime = 24*3600; // initialized to 24h so as that the time can be successively
29  // set down when an agent starts earlier until the earliest point of time an agent starts
30  private double time = 0.0;
31  private double stepSize = 1.0;
32 
33  public MobsimTimer(){
34  this(1.0);
35  }
36 
37 
38  public MobsimTimer(final double stepSize){
39  this.simStartTime = 24*3600;
40  this.time = 0;
41  this.stepSize = stepSize;
42  }
43 
44  public final double getSimStartTime() {
45  return this.simStartTime;
46  }
47 
48  public double getTimeOfDay() {
49  return this.time;
50  }
51 
52  public double incrementTime(){
53  this.time += stepSize;
54  return this.time;
55  }
56 
57  public final double getSimTimestepSize() {
58  return this.stepSize;
59  }
60 
61  public void setSimStartTime(double startTimeSec) {
62  this.simStartTime = startTimeSec;
63  }
64 
65  public void setTime(double timeSec) {
66  this.time = timeSec;
67  }
68 
69 }
void setSimStartTime(double startTimeSec)