|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.powertac.common.repo.TimeslotRepo
@Repository public class TimeslotRepo
Repository for Timeslots. Timeslots are created with makeTimeslot(). Several query methods are supported, including currentTimeslot(), enabledTimeslots(), and findBySerialNumber(). The implementation makes a strong assumption that timeslots are created in sequence, and that each timeslot starts when the previous timeslots ends.
| Constructor Summary | |
|---|---|
TimeslotRepo()
standard constructor |
|
| Method Summary | |
|---|---|
int |
count()
Returns the number of timeslots that have been successfully created. |
void |
createInitialTimeslots()
Creates timeslots to fill in the time from sim start to the current time. |
int |
currentSerialNumber()
Returns the serial number of the current timeslot |
Timeslot |
currentTimeslot()
Note that this scheme for finding the current timeslot relies on a timeslot sequence that does not have gaps between sim start and the current time. |
List<Timeslot> |
enabledTimeslots()
Returns the list of enabled timeslots, starting with the first by serial number. |
Timeslot |
findByInstant(org.joda.time.Instant time)
Returns the timeslot (if any) corresponding to a particular Instant. |
Timeslot |
findBySerialNumber(int serialNumber)
Returns the timeslot (if any) with the given serial number. |
Timeslot |
findOrCreateBySerialNumber(int serialNumber)
Returns the timeslot (if any) with the given serial number. |
int |
getTimeslotIndex(org.joda.time.Instant time)
Converts time to timeslot index without actually creating a timeslot |
Timeslot |
makeTimeslot(org.joda.time.Instant startTime)
Creates a timeslot with the given start time. |
void |
recycle()
Implementations must clear out the repository in preparation for a new simulation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public TimeslotRepo()
| Method Detail |
|---|
public Timeslot makeTimeslot(org.joda.time.Instant startTime)
public Timeslot currentTimeslot()
public int currentSerialNumber()
public Timeslot findBySerialNumber(int serialNumber)
public Timeslot findOrCreateBySerialNumber(int serialNumber)
public void createInitialTimeslots()
public Timeslot findByInstant(org.joda.time.Instant time)
public int getTimeslotIndex(org.joda.time.Instant time)
public List<Timeslot> enabledTimeslots()
public int count()
public void recycle()
DomainRepo
recycle in interface DomainRepo
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||