|
||||||||||
| 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 | |
|---|---|
void |
add(Timeslot timeslot)
Adds a timeslot that already exists. |
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()
Returns the timeslot for 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 with the given serial number. |
Timeslot |
findOrCreateBySerialNumber(int serialNumber)
Returns the timeslot with the given serial number. |
Timeslot |
getNext(Timeslot slot)
Returns the following timeslot. |
org.joda.time.Instant |
getTimeForIndex(int index)
Converts int timeslot index to time |
int |
getTimeslotIndex(org.joda.time.Instant time)
Converts time to timeslot index without actually creating a timeslot |
boolean |
isTimeslotEnabled(int index)
True just in case the timeslot with the given index is enabled. |
boolean |
isTimeslotEnabled(Timeslot ts)
True just in case the specified timeslot is enabled. |
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 Timeslot getNext(Timeslot slot)
public List<Timeslot> enabledTimeslots()
public boolean isTimeslotEnabled(Timeslot ts)
public boolean isTimeslotEnabled(int index)
public int count()
public void add(Timeslot timeslot)
public org.joda.time.Instant getTimeForIndex(int index)
public void recycle()
DomainRepo
recycle in interface DomainRepo
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||