Class TasksManager<T extends ManagedTask>

  • Type Parameters:
    T - the type of the actual ManagedTask

    public class TasksManager<T extends ManagedTask>
    extends java.lang.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 Summary

      Constructors 
      Constructor Description
      TasksManager​(T... tasks)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addTask​(T task)
      Adds a Task, taking its Priority in consideration.
      void addTasks​(java.util.List<T> tasks)
      Adds multiple Tasks.
      void addTasks​(T... tasks)
      Adds multiple Tasks.
      void clearAll()
      Clears all Tasks lists.
      int countTasks()
      Gets the number of Tasks.
      T getOneTask()
      Gets tasks sequentially.
      java.util.List<T> getTasks()
      Gets all Tasks.
      java.util.List<T> getTasks​(Priority priority)
      Get all tasks with the given Priority.
      void removeTask​(T task)
      Removes a Task.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TasksManager

        @SafeVarargs
        public TasksManager​(T... tasks)
    • Method Detail

      • addTasks

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

        public void addTasks​(java.util.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 java.util.List<T> getTasks()
        Gets all Tasks.
        Returns:
        a list of all Tasks.
      • getTasks

        public java.util.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