Class DirectoryTask

  • All Implemented Interfaces:
    Task, java.lang.Iterable<Task>

    public class DirectoryTask
    extends AbstactTask
    Represents a task which is a directory (so not derived form parsing a file).
    A directory has no state of its own but is in all the states that the containing tasks are.
    Author:
    alexxismachine (Ulrich David)
    • Constructor Detail

      • DirectoryTask

        public DirectoryTask​(Task parent,
                             java.lang.String path,
                             java.lang.String description)
        Create a DirectoryTask with the given parameters.
        Parameters:
        parent - the parent task.
        path - the directory which is represented by this task.
        description - the description of the task.
    • Method Detail

      • isInState

        public boolean isInState​(TaskState status)
        Tell if the task is in the asked status. A task is in a status if itself or one of the children is in that status. If given status is null must return true.

        This implementation first asks the subtasks if one of them is in the state. If there are no sub tasks returns true, so an empty directory is in every state. After that the own state field is compared with the status. If still no match, false will be returned.

        Specified by:
        isInState in interface Task
        Overrides:
        isInState in class AbstactTask
        Parameters:
        status - the task state
        Returns:
        true if the task is in the asked status.
      • getPath

        public java.lang.String getPath()
        Get the path of the filename.
        Returns:
        the path.