Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
Addressed automatic evaluators
Browse files Browse the repository at this point in the history
  • Loading branch information
JuliaPoo committed Mar 18, 2024
1 parent afaea0c commit db98bf7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
20 changes: 10 additions & 10 deletions src/main/java/anna/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ public abstract class Task {
protected static final DateTimeFormatter LOCALTIME_FORMAT = DateTimeFormatter.ofPattern(
"HH:mm:ss"
);
protected boolean done;
protected boolean isDone;
protected TaskID id;
protected String task;

/**
* Constructs a new Task with the specified task description, done status, and ID.
*
* @param task the description of the task
* @param done the status indicating whether the task is done or not
* @param isDone the status indicating whether the task is done or not
* @param id the ID of the task
*/
Task(String task, boolean done, TaskID id) {
this.done = done;
Task(String task, boolean isDone, TaskID id) {
this.isDone = isDone;
this.id = id;
this.task = task;
}
Expand All @@ -39,16 +39,16 @@ public abstract class Task {
* @return true if the task is done, otherwise false
*/
public boolean isDone() {
return done;
return isDone;
}

/**
* Sets the status of the task to done or not done.
*
* @param done the status to set
* @param isDone the status to set
*/
public void setDone(boolean done) {
this.done = done;
public void setDone(boolean isDone) {
this.isDone = isDone;
}

/**
Expand All @@ -66,7 +66,7 @@ public String taskId() {
* @return a string representation of the task
*/
public String toString() {
return String.format("[%s][%s] %s", id, done ? "X" : " ", taskStr());
return String.format("[%s][%s] %s", id, isDone ? "X" : " ", taskStr());
}

/**
Expand All @@ -75,7 +75,7 @@ public String toString() {
* @return the serialized string representation of the task
*/
public String serialise() {
return String.format("%s<0>%s<0>%s<1>", id, task, done ? "X" : " ");
return String.format("%s<0>%s<0>%s<1>", id, task, isDone ? "X" : " ");
}

/**
Expand Down
40 changes: 20 additions & 20 deletions src/main/java/anna/TaskFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public String toString() {

class Todo extends Task {

Todo(String task, boolean done) {
super(task, done, TaskID.TODO_ID);
Todo(String task, boolean isDone) {
super(task, isDone, TaskID.TODO_ID);
}

public String serialise() {
Expand All @@ -40,8 +40,8 @@ class Deadline extends Task {

private LocalDateTime deadline;

Deadline(String task, String deadline, boolean done) {
super(task, done, TaskID.DEADLINE_ID);
Deadline(String task, String deadline, boolean isDone) {
super(task, isDone, TaskID.DEADLINE_ID);
this.deadline = LocalDateTime.parse(deadline, DATETIME_FORMAT);
}

Expand All @@ -67,8 +67,8 @@ class Event extends Task {
private LocalDateTime to;
private LocalDateTime from;

Event(String task, String from, String to, boolean done) {
super(task, done, TaskID.EVENT_ID);
Event(String task, String from, String to, boolean isDone) {
super(task, isDone, TaskID.EVENT_ID);
this.from = LocalDateTime.parse(from, DATETIME_FORMAT);
this.to = LocalDateTime.parse(to, DATETIME_FORMAT);
}
Expand All @@ -95,8 +95,8 @@ public String taskStr() {
class FixedDuration extends Task {
private Duration timeNeeded;

FixedDuration(String task, String timeNeeded, boolean done) {
super(task, done, TaskID.FIXEDDURATION_ID);
FixedDuration(String task, String timeNeeded, boolean isDone) {
super(task, isDone, TaskID.FIXEDDURATION_ID);
this.timeNeeded = Duration.between(LocalTime.MIN, LocalTime.parse(timeNeeded));
}

Expand Down Expand Up @@ -128,59 +128,59 @@ public class TaskFactory {
* @param task the description of the task
* @param from the start time of the event
* @param to the end time of the event
* @param done the status indicating whether the task is done or not
* @param isDone the status indicating whether the task is done or not
* @return an Event task
*/
public static Task createEvent(
String task,
String from,
String to,
boolean done
boolean isDone
) {
return new Event(task, from, to, done);
return new Event(task, from, to, isDone);
}

/**
* Creates a Todo task.
*
* @param task the description of the task
* @param done the status indicating whether the task is done or not
* @param isDone the status indicating whether the task is done or not
* @return a Todo task
*/
public static Task createTodo(String task, boolean done) {
return new Todo(task, done);
public static Task createTodo(String task, boolean isDone) {
return new Todo(task, isDone);
}

/**
* Creates a Deadline task.
*
* @param task the description of the task
* @param deadline the deadline of the task
* @param done the status indicating whether the task is done or not
* @param isDone the status indicating whether the task is done or not
* @return a Deadline task
*/
public static Task createDeadline(
String task,
String deadline,
boolean done
boolean isDone
) {
return new Deadline(task, deadline, done);
return new Deadline(task, deadline, isDone);
}

/**
* Creates a FixedDuration task.
*
* @param task the description of the task
* @param timeNeeded the time needed for the task
* @param done the status indicating whether the task is done or not
* @param isDone the status indicating whether the task is done or not
* @return a FixedDuration task
*/
public static Task createFixedDuration(
String task,
String timeNeeded,
boolean done
boolean isDone
) {
return new FixedDuration(task, timeNeeded, done);
return new FixedDuration(task, timeNeeded, isDone);
}

/**
Expand Down

0 comments on commit db98bf7

Please sign in to comment.