public class Task extends Object
Modifier and Type | Field and Description |
---|---|
static int |
RUN_INFINITY |
static int |
RUN_ONCE |
Modifier | Constructor and Description |
---|---|
protected |
Task(int ticks,
int runCount)
Superclass constructor for subclasses.
|
|
Task(int delayTicks,
int repeatInterval,
int runCount,
Runnable runnable)
Creates a Task that stores the timing parameters for a task
|
|
Task(int repeatInterval,
int runCount,
Runnable runnable)
Creates a Task that stores the timing parameters for a task
|
Modifier and Type | Method and Description |
---|---|
void |
addSelf() |
int |
getInterval() |
Runnable |
getRunnable() |
int |
getRunsLeft() |
void |
removeTask() |
protected void |
run() |
Task |
setRunnable(Runnable runnable) |
void |
tick() |
public static final int RUN_INFINITY
public static final int RUN_ONCE
protected Task(int ticks, int runCount)
ticks
- number of ticks before the task runs the first time, as well as the repeating interval of the
task cycle, in ticks.runCount
- number of times to run the task. Pass RUN_INFINITY
to run an indefinite number of
times.public Task(int repeatInterval, int runCount, Runnable runnable)
repeatInterval
- number of ticks before the task runs the first time, as well as the repeating interval of
the task cycle, in ticks.runCount
- number of times to run the task. Pass RUN_INFINITY
to run an indefinite number of
times.runnable
- the task to runpublic Task(int delayTicks, int repeatInterval, int runCount, Runnable runnable)
delayTicks
- number of ticks before the the first time this task is run. Start counting from the current
tick (if Ticker
has started ticking). Pass 0 or 1 to run the task in the current
tick (if Ticker
has started ticking).repeatInterval
- the repeating interval of the task cycle, in ticks.runCount
- number of times to run the task. Pass RUN_INFINITY
to run an indefinite number of
times.runnable
- the task to run, or null
if this class is overridenCopyright © 2016. All rights reserved.