Package no.ntnu.idatt

Class Task

java.lang.Object
no.ntnu.idatt.Task
All Implemented Interfaces:
Serializable

public class Task extends Object implements Serializable
Task represents a single task yet to be completed Task is a mutable and serializable class.
See Also:
Serialized Form
  • Constructor Details

    • Task

      public Task(String label, String description, int priority, LocalDateTime dueDate, LocalDateTime addedDate, boolean completed)
      Constructor for importing Task objects from backup. Initializes all attributes.
      Parameters:
      label - The main description of the task
      description - Longer description of task
      priority - The importance of the task
      addedDate - When the task was added
      dueDate - When the task is due
      completed - If the task is completed or not
    • Task

      public Task(String label, int priority, LocalDateTime dueDate)
      Constructor for adding new task without description
      Parameters:
      label - The main description of the task
      priority - The importance of the task
      dueDate - When the task is due
    • Task

      public Task(String label, String description, int priority, LocalDateTime dueDate)
      Constructor for adding new task with description
      Parameters:
      label - The main description of the task
      description - A brief description of the task
      priority - The importance of the task
      dueDate - When the task is due
  • Method Details

    • getLabel

      public String getLabel()
    • getLabelInLowerCase

      public String getLabelInLowerCase()
      Gets the name of the task in all lower case
      Returns:
      the name in lower case
    • getDescription

      public String getDescription()
    • getPriority

      public int getPriority()
    • getDueDate

      public LocalDateTime getDueDate()
    • getAddedDate

      public LocalDateTime getAddedDate()
    • isCompleted

      public boolean isCompleted()
    • setLabel

      public void setLabel(String label)
    • setDescription

      public void setDescription(String description)
    • setDueDate

      public void setDueDate(LocalDateTime dueDate)
    • 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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object