Skip to content

Commit

Permalink
Refactor getDeadLine to getDeadline
Browse files Browse the repository at this point in the history
  • Loading branch information
howitzerg committed Oct 27, 2016
1 parent 8e98f4d commit 7254157
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 32 deletions.
14 changes: 7 additions & 7 deletions src/main/java/seedu/task/logic/commands/EditCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ public CommandResult execute() {

ReadOnlyTask taskToEdit = lastShownList.get(targetIndex - 1);

if (taskToEdit.getDeadLine().getDueDate().toString().isEmpty()
&& this.toEdit.getDeadLine().getDueDate().toString().equals(DEFAULT_DATE_STRING)) {
if (taskToEdit.getDeadline().getDueDate().toString().isEmpty()
&& this.toEdit.getDeadline().getDueDate().toString().equals(DEFAULT_DATE_STRING)) {
return new CommandResult(Deadline.MESSAGE_DEADLINE_CONSTRAINTS);
}

Expand All @@ -91,12 +91,12 @@ public CommandResult execute() {
if (this.toEdit.getName() == null) {
this.toEdit.setName(taskToEdit.getName());
}
if (this.toEdit.getDeadLine().getDueDate().toString().equals(EMPTY_TASK_OBJECT_STRING)
|| this.toEdit.getDeadLine().getDueDate().toString().equals(DEFAULT_DATE_STRING)) {
this.toEdit.setDueDate(taskToEdit.getDeadLine().getDueDate());
if (this.toEdit.getDeadline().getDueDate().toString().equals(EMPTY_TASK_OBJECT_STRING)
|| this.toEdit.getDeadline().getDueDate().toString().equals(DEFAULT_DATE_STRING)) {
this.toEdit.setDueDate(taskToEdit.getDeadline().getDueDate());
}
if (this.toEdit.getDeadLine().getDueTime().toString().equals(EMPTY_TASK_OBJECT_STRING)) {
this.toEdit.setDueTime(taskToEdit.getDeadLine().getDueTime());
if (this.toEdit.getDeadline().getDueTime().toString().equals(EMPTY_TASK_OBJECT_STRING)) {
this.toEdit.setDueTime(taskToEdit.getDeadline().getDueTime());
}
if (this.toEdit.getEventStart().getStartDate().toString().equals(EMPTY_TASK_OBJECT_STRING)
|| this.toEdit.getEventStart().getStartDate().toString().equals(DEFAULT_DATE_STRING)) {
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/seedu/task/model/task/ReadOnlyTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public interface ReadOnlyTask {

TaskName getName();
Deadline getDeadLine();
Deadline getDeadline();
EventStart getEventStart();
Importance getImportance();

Expand All @@ -27,8 +27,8 @@ default boolean isSameStateAs(ReadOnlyTask other) {
return other == this // short circuit if same object
|| (other != null // this is first to avoid NPE below
&& other.getName().equals(this.getName()) // state checks here onwards
&& other.getDeadLine().getDueDate().equals(this.getDeadLine().getDueDate())
&& other.getDeadLine().getDueTime().equals(this.getDeadLine().getDueTime())
&& other.getDeadline().getDueDate().equals(this.getDeadline().getDueDate())
&& other.getDeadline().getDueTime().equals(this.getDeadline().getDueTime())
&& other.getEventStart().getStartDate().equals(this.getEventStart().getStartDate())
&& other.getEventStart().getStartTime().equals(this.getEventStart().getStartTime())
&& other.getImportance().equals(this.getImportance()));
Expand All @@ -45,9 +45,9 @@ default String getAsText() {
.append(" Start Time: ")
.append(getEventStart().getStartTime())
.append(" End Date: ")
.append(getDeadLine().getDueDate())
.append(getDeadline().getDueDate())
.append(" End Time: ")
.append(getDeadLine().getDueTime())
.append(getDeadline().getDueTime())
.append(" Importance: ")
.append(getImportance())
.append(" Tags: ");
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/seedu/task/model/task/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Task(TaskName taskName, EventStart eventStart,Deadline deadline, Importan
* Copy constructor.
*/
public Task(ReadOnlyTask source) {
this(source.getName(),source.getEventStart(), source.getDeadLine(), source.getImportance(), source.getTags());
this(source.getName(),source.getEventStart(), source.getDeadline(), source.getImportance(), source.getTags());
}

public Task(EventStart eventStart, Deadline deadline, Importance importance, UniqueTagList tags) {
Expand Down Expand Up @@ -71,11 +71,11 @@ public void setName(TaskName name) {
}

public void setDueDate(Date date) {
this.getDeadLine().setDueDate(date);
this.getDeadline().setDueDate(date);
}

public void setDueTime(Time time) {
this.getDeadLine().setDueTime(time);
this.getDeadline().setDueTime(time);
}

public void setImportance(Importance importance) {
Expand Down Expand Up @@ -104,15 +104,15 @@ public boolean equals(Object other) {
@Override
public int hashCode() {
// use this method for custom fields hashing instead of implementing your own
return Objects.hash(taskName, getDeadLine(), importance, tags);
return Objects.hash(taskName, getDeadline(), importance, tags);
}

@Override
public String toString() {
return getAsText();
}

public Deadline getDeadLine() {
public Deadline getDeadline() {
return deadline;
}

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/task/storage/XmlAdaptedTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public XmlAdaptedTask() {}
*/
public XmlAdaptedTask(ReadOnlyTask source) {
taskName = source.getName().fullName;
dueDate = source.getDeadLine().getDueDate().toString();
dueTime = source.getDeadLine().getDueTime().value;
dueDate = source.getDeadline().getDueDate().toString();
dueTime = source.getDeadline().getDueTime().value;
startDate = source.getEventStart().getStartDate().toString();
startTime = source.getEventStart().getStartTime().value;
importance = source.getImportance().value;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/task/ui/CheckTaskAttributes.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ public boolean startTimeExists() {
}

public boolean endDateExists() {
if (!this.task.getDeadLine().getDueDate().toString().equals(EMPTY_TASK_OBJECT_STRING))
if (!this.task.getDeadline().getDueDate().toString().equals(EMPTY_TASK_OBJECT_STRING))
return true;

return false;
}

public boolean endTimeExists() {
if (!this.task.getDeadLine().getDueTime().toString().equals(EMPTY_TASK_OBJECT_STRING))
if (!this.task.getDeadline().getDueTime().toString().equals(EMPTY_TASK_OBJECT_STRING))
return true;

return false;
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/seedu/task/ui/TaskCard.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@ public void initialize() {
if (checkTask.startDateExists() && checkTask.endDateExists()) {
dueDate.setManaged(true);
dueDate.setText("Starts on " + task.getEventStart().getStartDate().toString() + " and to be completed by "
+ task.getDeadLine().getDueDate().toString());
+ task.getDeadline().getDueDate().toString());

} else if (checkTask.endDateExists()) {
dueDate.setManaged(true);
dueDate.setText("Task to be completed by Date: " + task.getDeadLine().getDueDate().toString());
dueDate.setText("Task to be completed by Date: " + task.getDeadline().getDueDate().toString());

} else if (checkTask.startDateExists()){
dueDate.setManaged(true);
Expand All @@ -70,12 +70,12 @@ public void initialize() {
if (checkTask.startTimeExists() && checkTask.endTimeExists()) {
dueTime.setManaged(true);
dueTime.setText("Starts at time " + task.getEventStart().getStartTime().value + " and ends at time "
+ task.getDeadLine().getDueTime().value + "hours");
+ task.getDeadline().getDueTime().value + "hours");
}

else if (checkTask.endTimeExists()) {
dueTime.setManaged(true);
dueTime.setText("Ends at time " + task.getDeadLine().getDueTime().value + "hours");
dueTime.setText("Ends at time " + task.getDeadline().getDueTime().value + "hours");
}

else if (checkTask.startTimeExists()) {
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/guitests/guihandles/TaskCardHandle.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public boolean isSameTask(ReadOnlyTask task){
// System.out.println(task.getDueTime().value+task.getDueTime()+"fulltimeexists");
// System.out.println(task.getDueDate().value+task.getDueDate()+"fulldatexists");
// System.out.println(task.getImportance().value+task.getImportance()+"fullimportanceexists");
return getFullName().equals(task.getName().fullName) && getDueTime().equals(task.getDeadLine().getDueTime().value)
&& getImportance().equals(task.getImportance().value) && getDueDate().equals(task.getDeadLine().getDueDate().toString());
return getFullName().equals(task.getName().fullName) && getDueTime().equals(task.getDeadline().getDueTime().value)
&& getImportance().equals(task.getImportance().value) && getDueDate().equals(task.getDeadline().getDueDate().toString());
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/test/java/seedu/address/logic/LogicManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,8 @@ String generateAddCommand(Task p) {
cmd.append("add ");

cmd.append(p.getName().toString());
cmd.append(" d/").append(p.getDeadLine().getDueDate().toString());
cmd.append(" e/").append(p.getDeadLine().getDueTime().toString());
cmd.append(" d/").append(p.getDeadline().getDueDate().toString());
cmd.append(" e/").append(p.getDeadline().getDueTime().toString());
cmd.append(" i/").append(p.getImportance());

UniqueTagList tags = p.getTags();
Expand Down
6 changes: 3 additions & 3 deletions src/test/java/seedu/address/testutil/TestTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public String getAddCommand() {
sb.append("add " + this.getName().fullName + " ");
sb.append("sd/" + this.getEventStart().getStartDate().toString() + " ");
sb.append("st/" + this.getEventStart().getStartTime().value + " ");
sb.append("d/" + this.getDeadLine().getDueDate().toString() + " ");
sb.append("e/" + this.getDeadLine().getDueTime().value + " ");
sb.append("d/" + this.getDeadline().getDueDate().toString() + " ");
sb.append("e/" + this.getDeadline().getDueTime().value + " ");
sb.append("i/" + this.getImportance().value + " ");
this.getTags().getInternalList().stream().forEach(s -> sb.append("t/" + s.tagName + " "));
return sb.toString();
}

@Override
public Deadline getDeadLine() {
public Deadline getDeadline() {
return this.deadline;
}

Expand Down

0 comments on commit 7254157

Please sign in to comment.