Class TasksManager<T extends ManagedTask>
java.lang.Object
io.openems.edge.common.taskmanager.TasksManager<T>
- Type Parameters:
T
- the type of the actualManagedTask
Manages a number of
ManagedTask
s with different priorities.
A useful application for TasksManager is to provide a list of Tasks that need to be handled on an OpenEMS Cycle run.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a Task, taking its Priority in consideration.void
Adds multiple Tasks.final void
Adds multiple Tasks.void
clearAll()
Clears all Tasks lists.int
Gets the number of Tasks.Gets tasks sequentially.getTasks()
Gets all Tasks.Get all tasks with the given Priority.void
removeTask
(T task) Removes a Task.
-
Constructor Details
-
TasksManager
-
-
Method Details
-
addTasks
Adds multiple Tasks.- Parameters:
tasks
- an array of Tasks
-
addTasks
Adds multiple Tasks.- Parameters:
tasks
- an array of Tasks
-
addTask
Adds a Task, taking its Priority in consideration.- Parameters:
task
- the Task
-
removeTask
Removes a Task.- Parameters:
task
- the Task
-
clearAll
public void clearAll()Clears all Tasks lists. -
countTasks
public int countTasks()Gets the number of Tasks.- Returns:
- number of Tasks
-
getTasks
Gets all Tasks.- Returns:
- a list of all Tasks.
-
getTasks
Get all tasks with the given Priority.- Parameters:
priority
- the Priority- Returns:
- a list of Tasks
-
getOneTask
Gets tasks sequentially.- Returns:
- the next task; null if there are no tasks
-