public final class EventScheduler extends Object
Constructor and Description |
---|
EventScheduler() |
Modifier and Type | Method and Description |
---|---|
void |
cancel(Event event)
Cancel the specified event.
|
void |
clock()
Fire next event, advance system time to that event
|
void |
clockThreadSafeEvents()
Process next thread-save event
|
double |
getCyclesPerSecond() |
long |
getTime(Event.Phase phase)
Get time with respect to a specific clock phase
|
boolean |
isPending(Event event)
Is the event pending in this scheduler?
|
Event.Phase |
phase()
Return current clock phase
|
void |
reset()
Cancel all pending events and reset time.
|
void |
schedule(Event event,
long cycles)
Add event to pending queue in the same phase as current event.
|
void |
schedule(Event event,
long cycles,
Event.Phase phase)
Add event to pending queue.
|
void |
scheduleAbsolute(Event event,
long absoluteCycles,
Event.Phase phase)
Schedule event to occur at some absolute time.
|
void |
scheduleThreadSafe(Event event)
Schedule an event in a thread-safe manner.
|
void |
scheduleThreadSafeKeyEvent(Event event)
Schedule a key event in a thread-safe manner.
|
void |
setCyclesPerSecond(double cyclesPerSecond) |
public void scheduleThreadSafeKeyEvent(Event event)
event
- The event to schedule.public void scheduleThreadSafe(Event event)
event
- The event to schedule.public void schedule(Event event, long cycles, Event.Phase phase)
event
- The event to addcycles
- How many cycles from now to firephase
- The phase when to fire the event.public void schedule(Event event, long cycles)
event
- The event to addcycles
- How many cycles from now to fire.public void scheduleAbsolute(Event event, long absoluteCycles, Event.Phase phase)
event
- The event to addabsoluteCycles
- When to firephase
- Phase when event firespublic void cancel(Event event)
event
- The event to cancelpublic void reset()
public void clock() throws InterruptedException
InterruptedException
public void clockThreadSafeEvents() throws InterruptedException
InterruptedException
public boolean isPending(Event event)
event
- the eventpublic long getTime(Event.Phase phase)
phase
- The phasepublic Event.Phase phase()
public double getCyclesPerSecond()
public void setCyclesPerSecond(double cyclesPerSecond)
Copyright © 2018 Ken Händel. All rights reserved.