public abstract class SchedulerBase<T extends SchedulerBase.SchedulableRecord> extends java.lang.Object implements Scheduler
| Modifier and Type | Class and Description |
|---|---|
protected static class |
SchedulerBase.SchedulableRecord
A scheduled task.
|
| Modifier and Type | Field and Description |
|---|---|
protected int |
dryRunFrames |
protected com.badlogic.gdx.utils.IntArray |
phaseCounters |
protected com.badlogic.gdx.utils.Array<T> |
runList |
protected com.badlogic.gdx.utils.Array<T> |
schedulableRecords
The list of the scheduled tasks.
|
| Constructor and Description |
|---|
SchedulerBase(int dryRunFrames)
Creates a
SchedulerBase. |
| Modifier and Type | Method and Description |
|---|---|
protected int |
calculatePhase(int frequency)
This method is invoked by
Scheduler.addWithAutomaticPhasing(Schedulable, int) and calculates the best phase based on the
number of frames of the dry run. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitadd, addWithAutomaticPhasingrunprotected com.badlogic.gdx.utils.Array<T extends SchedulerBase.SchedulableRecord> schedulableRecords
protected com.badlogic.gdx.utils.Array<T extends SchedulerBase.SchedulableRecord> runList
protected com.badlogic.gdx.utils.IntArray phaseCounters
protected int dryRunFrames
public SchedulerBase(int dryRunFrames)
SchedulerBase.dryRunFrames - number of frames simulated by the dry run to calculate the phase when adding a schedulable via
Scheduler.addWithAutomaticPhasing(Schedulable, int)protected int calculatePhase(int frequency)
Scheduler.addWithAutomaticPhasing(Schedulable, int) and calculates the best phase based on the
number of frames of the dry run. The optimal phase is guaranteed if the number of simulated frames is at least as large as
the size of the least common multiple (LCM, see ArithmeticUtils.lcmPositive(int, int)) of all the frequency values
used in the scheduler so far.frequency - the frequency of the skedulable task to add