|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.powertac.common.TimeService
@Scope(value="singleton") @Service public class TimeService
This is the simulation time-keeper and event queue. Here's how it works:
currentTime = base + (systemTime - start) * rate
| Field Summary | |
|---|---|
static long |
DAY
|
static long |
HOUR
|
static long |
MINUTE
|
static long |
SECOND
|
static long |
WEEK
|
| Constructor Summary | |
|---|---|
TimeService()
Default constructor. |
|
TimeService(long base,
long start,
long rate,
long modulo)
Handy constructor for testing |
|
| Method Summary | |
|---|---|
void |
addAction(org.joda.time.Instant time,
TimedAction act)
Adds an action to the simulation queue, to be triggered at the specified time. |
long |
getBase()
|
org.joda.time.Instant |
getBaseInstant()
|
org.joda.time.DateTime |
getCurrentDateTime()
|
org.joda.time.Instant |
getCurrentTime()
Returns the current time as an Instant |
int |
getHourOfDay()
Returns the current hour-of-day |
long |
getModulo()
|
long |
getRate()
|
long |
getStart()
|
void |
init()
Sets current time to modulo before base time. |
void |
setBase(long value)
Deprecated. use setClockParameters instead |
void |
setClockParameters(long base,
long rate,
long modulo)
Sets base, rate, and modulo clock parameters with a single call. |
protected void |
setCurrentTime(org.joda.time.base.AbstractDateTime time)
Sets current time to a specific value. |
void |
setCurrentTime(org.joda.time.Instant time)
Sets current time to a specific value. |
void |
setModulo(long value)
Deprecated. use setClockParameters instead |
void |
setRate(long value)
Deprecated. use setClockParameters instead |
void |
setStart(long start)
|
org.joda.time.Instant |
truncateInstant(org.joda.time.Instant time,
long mod)
Returns the most recent Instant at which time % modulo was zero |
void |
updateTime()
Updates simulation time when called as specified by clock parameters, then runs any actions that may be due. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final long SECOND
public static final long MINUTE
public static final long HOUR
public static final long DAY
public static final long WEEK
| Constructor Detail |
|---|
public TimeService()
public TimeService(long base,
long start,
long rate,
long modulo)
| Method Detail |
|---|
public void init()
public void updateTime()
public org.joda.time.Instant truncateInstant(org.joda.time.Instant time,
long mod)
public void setClockParameters(long base,
long rate,
long modulo)
public long getBase()
public org.joda.time.Instant getBaseInstant()
@Deprecated public void setBase(long value)
setClockParameters instead
public long getStart()
public void setStart(long start)
public long getRate()
@Deprecated public void setRate(long value)
setClockParameters instead
public long getModulo()
@Deprecated public void setModulo(long value)
setClockParameters instead
public org.joda.time.Instant getCurrentTime()
public org.joda.time.DateTime getCurrentDateTime()
public int getHourOfDay()
public void setCurrentTime(org.joda.time.Instant time)
protected void setCurrentTime(org.joda.time.base.AbstractDateTime time)
public void addAction(org.joda.time.Instant time,
TimedAction act)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||