|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectTaxiProject05.environment.SimTime
public class SimTime
Holds the time in the simulation. Thread safe. Examples: //get current time double timemillis = SimTime.getInstance().getCurrentTimeMillis(); Date d = SimTime.getInstance().getCurrentDate(); //change speed of simulation SimTime.getInstance().setTimeFactor(SimTime.TimeFactor_Fast);
| Field Summary | |
|---|---|
static long |
TimeFactor_Fast
Timefactor for slow speed (x60 from realtime) |
static long |
TimeFactor_Normal
Timefactor for slow speed (x60 from realtime) |
static long |
TimeFactor_Pause
Tidsfaktor som används för paus |
static long |
TimeFactor_RealTime
Timefactor for realtime speed |
static long |
TimeFactor_Slow
Timefactor for slow speed (x60 from realtime) |
| Method Summary | |
|---|---|
java.util.Date |
getCurrentDate()
Gets the current Date in the simulation. |
long |
getCurrentTimeMillis()
Get the current time in the simulation. in |
static SimTime |
getInstance()
Use this -> Get the singleton instance. |
java.util.Date |
getRealDate(java.util.Date d)
Converts a simulation time to a real system time. |
long |
getTimeFactor()
|
void |
resetTime()
Nollställer tiden till standard-starttiden. |
void |
setAlarm(java.util.TimerTask task,
java.util.Date time)
Schedule a timer task to a specific time. |
void |
setTime(long t)
Sets the simulation time to a specific datetime. |
void |
setTimeFactor(long timeFactor)
Change the factor for the time simulation. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long TimeFactor_Pause
public static final long TimeFactor_RealTime
public static final long TimeFactor_Slow
public static final long TimeFactor_Normal
public static final long TimeFactor_Fast
| Method Detail |
|---|
public static SimTime getInstance()
public void resetTime()
public void setTime(long t)
t - the time to set to in millis. Date.getTime().public long getTimeFactor()
public void setTimeFactor(long timeFactor)
timeFactor - The timeFactor to set.public long getCurrentTimeMillis()
public java.util.Date getCurrentDate()
public java.util.Date getRealDate(java.util.Date d)
d - a simulation time.
public void setAlarm(java.util.TimerTask task,
java.util.Date time)
task - A Task with the method that should be executed the specified time.time - The time when the task should be done.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||