@Service public class TimeslotRepo extends Object implements DomainRepo
Constructor and Description |
---|
TimeslotRepo()
standard constructor
|
Modifier and Type | Method and Description |
---|---|
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.
|
org.joda.time.DateTime |
getDateTimeForIndex(int index)
Converts int timeslot index to DateTime in UTC timezone
|
Timeslot |
getNext(Timeslot slot)
Returns the following timeslot.
|
org.joda.time.Instant |
getTimeForIndex(int index)
Converts int timeslot index to Instant
|
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.
|
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 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 org.joda.time.DateTime getDateTimeForIndex(int index)
public void recycle()
DomainRepo
recycle
in interface DomainRepo
Copyright © 2019 Power TAC. All rights reserved.