Package amadeus.workspace
Class Task
java.lang.Object
amadeus.workspace.Task
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract StringReturns the details of the task.booleangetDone()Returns the completion status of the task.getName()Returns the name or description of the task.voidPrints the task's name and completion status to the console.abstract StringConverts the task to a file-friendly format.toString()Returns a string representation of the task, which is its name.voidupdateDone(boolean status) Updates the completion status of the task.
-
Field Details
-
name
The name or description of the task. -
isDone
protected boolean isDoneThe completion status of the task (true if complete, false if incomplete).
-
-
Constructor Details
-
Task
Initializes a newTaskwith the given name. The task is marked as incomplete by default.- Parameters:
input- the name or description of the task; must not benull.
-
Task
Initializes a newTaskwith the given name and completion status.- Parameters:
input- the name or description of the task; must not benull.done- a boolean indicating whether the task is completed (true) or not (false).
-
-
Method Details
-
getName
Returns the name or description of the task.- Returns:
- the name or description of the task.
-
getDone
public boolean getDone()Returns the completion status of the task.- Returns:
trueif the task is complete,falseotherwise.
-
getDetails
Returns the details of the task.Subclasses must implement this method to provide task-specific details.
- Returns:
- the details of the task as a formatted string.
-
updateDone
public void updateDone(boolean status) Updates the completion status of the task.- Parameters:
status- the new completion status (true for complete, false for incomplete).
-
toString
Returns a string representation of the task, which is its name. -
printTask
public void printTask()Prints the task's name and completion status to the console. If the task is complete, a checkmark (✔️) is displayed next to the name. -
toFileFormat
Converts the task to a file-friendly format.Subclasses must implement this method to provide a format suitable for saving to a file.
- Returns:
- a string representation of the task in a format suitable for saving to a file.
-