Package de.japrost.staproma.task
Class AbstactTask
- java.lang.Object
-
- de.japrost.staproma.task.AbstactTask
-
- Direct Known Subclasses:
AnonymousTask
,DirectoryTask
,FolderTask
,LeafTask
public abstract class AbstactTask extends java.lang.Object implements Task
This is a simple base implementation of a Task.- Author:
- alexxismachine (Ulrich David)
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstactTask(Task parent, java.lang.String description)
Create a task with the given parameter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addChild(Task task)
Add a child to the task. (???void
addContent(java.lang.String line)
Add a line to the content collection.java.util.List<java.lang.String>
getContent()
Get the content collection.java.lang.String
getDescription()
Get the tasks description.Task
getParent()
Get the praent task.short
getPriority()
Get the priority, The lower the number the higher the priority.boolean
hasChildren()
Tell if there are children to the task.boolean
isInState(TaskState status)
Tell if the task is in the asked status.java.util.Iterator<Task>
iterator()
java.util.List<java.lang.Short>
priorities()
Get the priorities that this task and all the sub tasks are in.void
setPriority(short priority)
Set the priority.void
setState(TaskState state)
Set the state of the Task
-
-
-
Constructor Detail
-
AbstactTask
protected AbstactTask(Task parent, java.lang.String description)
Create a task with the given parameter.- Parameters:
parent
- the parent task.description
- the description.
-
-
Method Detail
-
setState
public void setState(TaskState state)
Set the state of the Task- Parameters:
state
- the new state.
-
isInState
public boolean isInState(TaskState status)
Description copied from interface:Task
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 isnull
must returntrue
.
-
iterator
public java.util.Iterator<Task> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<Task>
-
hasChildren
public boolean hasChildren()
Description copied from interface:Task
Tell if there are children to the task.- Specified by:
hasChildren
in interfaceTask
- Returns:
true
if there are children.
-
addChild
public void addChild(Task task)
Description copied from interface:Task
Add a child to the task. (??? Sets the parent of the added task to this???).
-
getDescription
public java.lang.String getDescription()
Description copied from interface:Task
Get the tasks description.- Specified by:
getDescription
in interfaceTask
- Returns:
- the description.
-
getContent
public java.util.List<java.lang.String> getContent()
Description copied from interface:Task
Get the content collection.- Specified by:
getContent
in interfaceTask
- Returns:
- the content collection. MUST NOT be
null
. MAY be an unmodifiable collection.
-
addContent
public void addContent(java.lang.String line)
Description copied from interface:Task
Add a line to the content collection.- Specified by:
addContent
in interfaceTask
- Parameters:
line
- the line to add.
-
getPriority
public short getPriority()
Get the priority, The lower the number the higher the priority.- Specified by:
getPriority
in interfaceTask
- Returns:
- the priority. '0' if not specified.
-
setPriority
public void setPriority(short priority)
Set the priority.- Parameters:
priority
- the new priority.
-
priorities
public java.util.List<java.lang.Short> priorities()
Get the priorities that this task and all the sub tasks are in.This implementation returns the own and all sub task priorities.
- Specified by:
priorities
in interfaceTask
- Returns:
- the priorities;
-
-