public class SimpleTimerState extends Object implements TimerState.Mutable
TimerState keeping timers in simple lists.
Note that this timer state implementation is not recommended for larger numbers of concurrent timers as it takes O(n) time to find the timer with the next deadline!
TimerState.Mutable, TimerState.Static| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_INITIAL_CAPACITY |
REPETITION_SINGLE| Constructor and Description |
|---|
SimpleTimerState() |
SimpleTimerState(int initialCapacity) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(long id,
int type,
int repetition,
long time,
long timeout) |
int |
count() |
boolean |
hasTimer(long id) |
long |
id(int index) |
int |
indexById(long id) |
int |
indexOfNextDeadline() |
void |
remove(int index) |
int |
repetition(int index) |
void |
repetition(int index,
int repetition) |
long |
time(int index) |
long |
timeout(int index) |
String |
toString() |
int |
type(int index) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitremoveByIddeadline, nextRepetitionpublic static final int DEFAULT_INITIAL_CAPACITY
public SimpleTimerState()
public SimpleTimerState(int initialCapacity)
public int count()
count in interface TimerStatepublic boolean hasTimer(long id)
hasTimer in interface TimerStatepublic long id(int index)
id in interface TimerStatepublic int type(int index)
type in interface TimerStatepublic int repetition(int index)
repetition in interface TimerStatepublic long time(int index)
time in interface TimerStatepublic long timeout(int index)
timeout in interface TimerStatepublic int indexById(long id)
indexById in interface TimerStatepublic void remove(int index)
remove in interface TimerState.Mutablepublic boolean add(long id,
int type,
int repetition,
long time,
long timeout)
add in interface TimerState.Mutablepublic void repetition(int index,
int repetition)
repetition in interface TimerState.Mutablepublic int indexOfNextDeadline()
indexOfNextDeadline in interface TimerStateCopyright © 2020 tools4j.org (Marco Terzer, Anton Anufriev). All Rights Reserved.