Class TasksManager<T extends ManagedTask>

  • Type Parameters:
    T -

    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.
      java.util.List<T> getAllTasks()
      Gets all Tasks.
      java.util.List<T> getAllTasks​(Priority priority)
      Get all tasks with the given Priority.
      java.util.List<T> getNextTasks()
      Gets the next Tasks.
      T getOneTask()
      Gets tasks sequentially.
      T getOneTask​(Priority priority)
      Gets one task that is lower than the given Priority sequentially.
      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.
      • getAllTasks

        public java.util.List<T> getAllTasks​(Priority priority)
        Get all tasks with the given Priority.
        Parameters:
        priority - the Priority
        Returns:
        a list of Tasks
      • getNextTasks

        public java.util.List<T> getNextTasks()
        Gets the next Tasks. This should normally be called once per Cycle.
        Returns:
        a list of Tasks.
      • getAllTasks

        public java.util.List<T> getAllTasks()
        Gets all Tasks.
        Returns:
        a list of all Tasks.
      • getOneTask

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

        public T getOneTask​(Priority priority)
        Gets one task that is lower than the given Priority sequentially.
        Returns:
        the next task; null if there are no tasks with the given Priority