]> git.mxchange.org Git - hub.git/blobdiff - application/hub/interfaces/handler/task/class_HandleableTask.php
State pattern added, hub continued (sorry, I let it lay around uncommitted for long...
[hub.git] / application / hub / interfaces / handler / task / class_HandleableTask.php
index f805475ca4cf9e234b48db604314b396e6ff4b35..4aaceba712b4d266ab0a80fc0968fbc5f02f5aad 100644 (file)
@@ -4,7 +4,7 @@
  *
  * @author             Roland Haeder <webmaster@ship-simu.org>
  * @version            0.0.0
- * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team
  * @license            GNU GPL 3.0 or any newer version
  * @link               http://www.ship-simu.org
  *
@@ -26,13 +26,29 @@ interface HandleableTask extends Handleable {
         * Registers a task with a task handler. This method throws a
         * TaskAlreadyRegisteredException if the task has already been registered
         *
-        * @param       $taskName       A task name to register the task on
+        * @param       $taskName               A task name to register the task on
         * @param       $taskInstance   The instance we should register as a task
         * @return      void
-        * @throws      TaskAlreadyRegisteredException  If the given task is already registered
         */
        function registerTask ($taskName, Visitable $taskInstance);
+
+       /**
+        * Checks wether tasks are left including idle task.
+        *
+        * @return      $tasksLeft      Wether there are tasks left to handle
+        */
+       function hasTasksLeft ();
+
+       /**
+        * Handles all tasks by checking if they should startup or if it is their
+        * turn to run. You should use this method in a while() loop in conjuntion
+        * with hasTasksLeft() so you can e.g. shutdown by adding a ShutdownTask
+        * which will attempt to remove all tasks from the task handler.
+        *
+        * @return      void
+        */
+       function handleTasks ();
 }
 
-//
+// [EOF]
 ?>