Skip to content
This repository has been archived by the owner on Jan 10, 2022. It is now read-only.

Commit

Permalink
Rename at/by to atDateTime/byDateTime to avoid ambiguity
Browse files Browse the repository at this point in the history
  • Loading branch information
fsgmhoward committed Feb 23, 2021
1 parent b87e76b commit 84bb278
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
5 changes: 2 additions & 3 deletions src/main/java/duke/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,8 @@ public Command parse(String fullCommand) throws InvalidInputException {
}

// Store the last k-v pair
if (!values.isEmpty()) {
arguments.put(key, String.join(DELIMITER, values));
}
// Store even when `values` is empty, as that indicates an empty string
arguments.put(key, String.join(DELIMITER, values));

// Initialize a respective class from the command (by capitalize first character)
String className = tokens[0] + "Command";
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/duke/task/Deadline.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ public class Deadline extends Task {
// This value indicates the version of this class when doing serialization
public static final long serialVersionUID = 2L;

protected DateTime by;
protected DateTime byDateTime;

/**
* Initialize the deadline task and set the typeIcon to 'D'
* @param description Description of the task, cannot be empty
* @param by The date and time this task has to be done before
* @param byDateTime The date and time this task has to be done before
* @throws InvalidInputException This is thrown if the task description is null or an empty string
*/
public Deadline(String description, DateTime by) throws InvalidInputException {
public Deadline(String description, DateTime byDateTime) throws InvalidInputException {
super(description);
this.by = by;
this.byDateTime = byDateTime;
typeIcon = "D";
}

Expand All @@ -31,14 +31,14 @@ public Deadline(String description, DateTime by) throws InvalidInputException {
*/
@Override
public Boolean isSameDate(DateTime dateTime) {
return by.isSameDate(dateTime);
return byDateTime.isSameDate(dateTime);
};

/**
* Converts this task to a descriptive string
*/
@Override
public String toString() {
return super.toString() + String.format(" (by: %s)", by);
return super.toString() + String.format(" (by: %s)", byDateTime);
}
}
12 changes: 6 additions & 6 deletions src/main/java/duke/task/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ public class Event extends Task {
// This value indicates the version of this class when doing serialization
public static final long serialVersionUID = 2L;

protected DateTime at;
protected DateTime atDateTime;

/**
* Initialize the event task and set the typeIcon to 'E'
* @param description Description of the task, cannot be empty
* @param at The date and time this event falls at
* @param atDateTime The date and time this event falls at
* @throws InvalidInputException This is thrown if the task description is null or an empty string
*/
public Event(String description, DateTime at) throws InvalidInputException {
public Event(String description, DateTime atDateTime) throws InvalidInputException {
super(description);
this.at = at;
this.atDateTime = atDateTime;
typeIcon = "E";
}

Expand All @@ -31,14 +31,14 @@ public Event(String description, DateTime at) throws InvalidInputException {
*/
@Override
public Boolean isSameDate(DateTime dateTime) {
return at.isSameDate(dateTime);
return atDateTime.isSameDate(dateTime);
};

/**
* Converts this task to a descriptive string
*/
@Override
public String toString() {
return super.toString() + String.format(" (at: %s)", at);
return super.toString() + String.format(" (at: %s)", atDateTime);
}
}

0 comments on commit 84bb278

Please sign in to comment.