Package org.omegazero.common.event.task
Interface Task
- All Superinterfaces:
Comparable<Task>,Runnable
- All Known Implementing Classes:
AbstractTask,LambdaTask,ReflectTask,RunnableTask,TaskScheduler.TimerTask
Represents a
Runnable with a priority.- Since:
- 2.6
- API Note:
- Before version 2.9, this was an abstract class. The class was partially moved to
AbstractTask.
-
Method Summary
-
Method Details
-
run
void run()Runs thisTask. Exact behavior is implementation-defined.General behavior includes running a task handler (for example a method).
- Specified by:
runin interfaceRunnable- Throws:
ExecutionFailedException- If an error occurs during execution of the task
-
getPriority
int getPriority()Returns the priority of this task. A lower priority number means this task has a higher priority.- Returns:
- The priority of this task
-
compareTo
Compares thisTaskto the givenTask.The return value is negative if this priority task has higher priority than the given priority task (meaning a lower priority number), positive if this task has lower priority than the given task, and
0if the priority of both tasks is equal.- Specified by:
compareToin interfaceComparable<Task>- Returns:
- A negative integer, zero, or a positive integer if this task has higher, equal, or lower priority than the given task, respectively
-