java.lang.Object
no.ntnu.idatt.Task
- All Implemented Interfaces:
Serializable
Task
represents a single task yet to be completed
Task
is a mutable and serializable class.- See Also:
- Serialized Form
-
Constructor Summary
ConstructorsConstructorDescriptionTask(String label, int priority, LocalDateTime dueDate)
Constructor for adding new task without descriptionTask(String label, String description, int priority, LocalDateTime dueDate)
Constructor for adding new task with descriptionTask(String label, String description, int priority, LocalDateTime dueDate, LocalDateTime addedDate, boolean completed)
Constructor for importingTask
objects from backup. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getLabel()
Gets the name of the task in all lower caseint
int
hashCode()
boolean
void
setCompleted(boolean completed)
void
setDescription(String description)
void
setDueDate(LocalDateTime dueDate)
void
boolean
setPriority(int priority)
Sets the priority of the task.toString()
-
Constructor Details
-
Task
public Task(String label, String description, int priority, LocalDateTime dueDate, LocalDateTime addedDate, boolean completed)Constructor for importingTask
objects from backup. Initializes all attributes.- Parameters:
label
- The main description of the taskdescription
- Longer description of taskpriority
- The importance of the taskaddedDate
- When the task was addeddueDate
- When the task is duecompleted
- If the task is completed or not
-
Task
Constructor for adding new task without description- Parameters:
label
- The main description of the taskpriority
- The importance of the taskdueDate
- When the task is due
-
Task
Constructor for adding new task with description- Parameters:
label
- The main description of the taskdescription
- A brief description of the taskpriority
- The importance of the taskdueDate
- When the task is due
-
-
Method Details
-
getLabel
-
getLabelInLowerCase
Gets the name of the task in all lower case- Returns:
- the name in lower case
-
getDescription
-
getPriority
public int getPriority() -
getDueDate
-
getAddedDate
-
isCompleted
public boolean isCompleted() -
setLabel
-
setDescription
-
setDueDate
-
setPriority
public boolean setPriority(int priority)Sets the priority of the task. Only changes the value if input is in range 0 to 4- Parameters:
priority
- the priority of the task, lower has higher priority- Returns:
true
if the priority was changed;false
if not
-
setCompleted
public void setCompleted(boolean completed) -
equals
-
hashCode
public int hashCode() -
toString
-