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 importingTaskobjects from backup. -
Method Summary
Modifier and TypeMethodDescriptionbooleangetLabel()Gets the name of the task in all lower caseintinthashCode()booleanvoidsetCompleted(boolean completed)voidsetDescription(String description)voidsetDueDate(LocalDateTime dueDate)voidbooleansetPriority(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 importingTaskobjects 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:
trueif the priority was changed;falseif not
-
setCompleted
public void setCompleted(boolean completed) -
equals
-
hashCode
public int hashCode() -
toString
-