public abstract class Scheduler extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Scheduler.State
The state of the scheduler.
|
Modifier and Type | Field and Description |
---|---|
static BigFraction |
DEFAULT_RESOLUTION
One millisecond at standard playback speed.
|
Constructor and Description |
---|
Scheduler() |
Modifier and Type | Method and Description |
---|---|
Interval |
getCurrentInterval()
Retrieves an
Interval that extends before and after the current
instant by half the minimum resolution. |
abstract long |
getElapsedMillis()
Implementations of the Scheduler class must provide the present time when
queried.
|
BigFraction |
getHalfMinimum() |
BigFraction |
getMinimumResolution() |
BigFraction |
getNow()
Returns the current time in milliseconds divided by the period.
|
PatternCollection |
getPatternsWithActiveMappings()
Retrieve the patterns that we must query for callbacks.
|
long |
getPeriod() |
void |
pause()
Pause playback.
|
void |
play()
Start playback.
|
void |
setPatterns(PatternCollection patterns)
Sets the
PatternCollection associated with this scheduler, needs
for active mappings. |
void |
setPeriod(long periodMillis)
Sets the period of the scheduler.
|
void |
stop()
Stop playback.
|
void |
update()
Runs all callbacks associated with the current interval.
|
void |
updateFor(Interval interval)
Runs all callbacks for a given interval.
|
public static final BigFraction DEFAULT_RESOLUTION
public abstract long getElapsedMillis()
public BigFraction getNow()
public Interval getCurrentInterval()
Interval
that extends before and after the current
instant by half the minimum resolution.public void play()
public void pause()
public void stop()
play()
is called again.public long getPeriod()
public BigFraction getMinimumResolution()
public BigFraction getHalfMinimum()
public void setPeriod(long periodMillis)
periodMillis
- the new periodpublic void update()
public void updateFor(Interval interval)
interval
- the interval over which to run callbackspublic PatternCollection getPatternsWithActiveMappings()
public void setPatterns(PatternCollection patterns)
PatternCollection
associated with this scheduler, needs
for active mappings.patterns
- the patterns to manage with this schedulerProcessing Library loom by Cora Johnson-Roberson. (c) 2014-2016