Class TasksManager<T extends ManagedTask>

java.lang.Object
io.openems.edge.common.taskmanager.TasksManager<T>
Type Parameters:
T - the type of the actual ManagedTask

public class TasksManager<T extends ManagedTask> extends Object
Manages a number of ManagedTasks 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 Details

  • Method Details

    • addTasks

      @SafeVarargs public final void addTasks(T... tasks)
      Adds multiple Tasks.
      Parameters:
      tasks - an array of Tasks
    • addTasks

      public void addTasks(List<T> tasks)
      Adds multiple Tasks.
      Parameters:
      tasks - an array of Tasks
    • addTask

      public void addTask(T task)
      Adds a Task, taking its Priority in consideration.
      Parameters:
      task - the Task
    • removeTask

      public void removeTask(T task)
      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

      public List<T> getTasks()
      Gets all Tasks.
      Returns:
      a list of all Tasks.
    • getTasks

      public List<T> getTasks(Priority priority)
      Get all tasks with the given Priority.
      Parameters:
      priority - the Priority
      Returns:
      a list of Tasks
    • getOneTask

      public T getOneTask()
      Gets tasks sequentially.
      Returns:
      the next task; null if there are no tasks