Class TrcTaskMgr.TaskObject

java.lang.Object
trclib.robotcore.TrcTaskMgr.TaskObject
Enclosing class:
TrcTaskMgr

public static class TrcTaskMgr.TaskObject extends Object
This class implements TaskObject that will be created whenever a class is registered as a cooperative multi-tasking task. The created task objects will be entered into an array list of task objects to be scheduled by the scheduler.
  • Method Details

    • toString

      public String toString()
      This method returns the instance name of the task.
      Overrides:
      toString in class Object
      Returns:
      instance name of the class.
    • registerTask

      public boolean registerTask(TrcTaskMgr.TaskType type, long taskInterval, int taskPriority)
      This method adds the given task type to the task object.
      Parameters:
      type - specifies the task type.
      taskInterval - specifies the periodic interval for STANDALONE_TASK, ignore for any other task types. If zero interval is specified, the task will be run in a tight loop.
      taskPriority - specifies the priority of the associated thread. Only valid for STANDALONE_TASK, ignored for any other task types.
      Returns:
      true if successful, false if the task with that task type is already registered in the task list.
    • registerTask

      public boolean registerTask(TrcTaskMgr.TaskType type, long taskInterval)
      This method adds the given task type to the task object.
      Parameters:
      type - specifies the task type.
      taskInterval - specifies the periodic interval for STANDALONE_TASK, ignore for any other task types. If zero interval is specified, the task will be run in a tight loop.
      Returns:
      true if successful, false if the task with that task type is already registered in the task list.
    • registerTask

      public boolean registerTask(TrcTaskMgr.TaskType type)
      This method adds the given task type to the task object.
      Parameters:
      type - specifies the task type.
      Returns:
      true if successful, false if the task with that task type is already registered in the task list.
    • unregisterTask

      public boolean unregisterTask(TrcTaskMgr.TaskType type)
      This method removes the given task type from the task object.
      Parameters:
      type - specifies the task type.
      Returns:
      true if successful, false if the task with that type is not found the task list.
    • unregisterTask

      public boolean unregisterTask()
      This method unregisters the given task object from all task types.
      Returns:
      true if successfully removed from any task type, false otherwise.
    • isRegistered

      public boolean isRegistered(TrcTaskMgr.TaskType type)
      This method checks if the given task type is registered with this task object.
      Parameters:
      type - specifies the task type to be checked against.
      Returns:
      true if this task is registered with the given type, false otherwise.
    • isRegistered

      public boolean isRegistered()
      This method checks if this task object is registered for any task type.
      Returns:
      true if this task is registered with any type, false otherwise.
    • getTaskInterval

      public long getTaskInterval()
      This method returns the task interval for TaskType.STANDALONE_TASK.
      Returns:
      task interval in msec. If there is no STANDALONE_TASK type in the task object, zero is returned.
    • setTaskInterval

      public void setTaskInterval(long taskInterval)
      This method sets the task interval for TaskType.STANDALONE_TASK. It has no effect for any other types.
      Parameters:
      taskInterval - specifies the periodic interval for STANDALONE_TASK, ignore for any other task types. If zero interval is specified, the task will be run in a tight loop.
    • setTaskData

      public void setTaskData(Object data)
      This method sets the task data for TaskType.STANDALONE_TASK. It has no effect for any other types.
      Parameters:
      data - specifies the thread data for STANDALONE_TASK, ignore for any other task types.