Skip to content

Commit

Permalink
Merge pull request #44 from yeapcl/branch-yeapcl-changeTimetableObjec…
Browse files Browse the repository at this point in the history
…tType

Branch yeapcl change timetable object type
  • Loading branch information
yeapcl authored Oct 13, 2020
2 parents 4a94674 + 8320d30 commit bb8ab2a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
4 changes: 2 additions & 2 deletions src/main/java/seedu/duke/command/AddCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ public void execute(UserList users, Ui ui, User nowUser/*, Storage storage*/) th
String[] parsedInputs = input.split(" /", 4);
String[] timeInputs = parsedInputs[2].split("-", 2);

String date = parsedInputs[1];
String date = parsedInputs[1].toLowerCase();

for (int i = 0; i < users.getTotalUserCount(); i++) {
if ((users.getUser(i + 1).getName() == nowUser.getName())) {
if ((users.getUser(i + 1).getName().equals(nowUser.getName()))) {
Event newEvent = new Event(parsedInputs[0], parsedInputs[3], timeInputs[0], timeInputs[1]);
ui.printEvent(newEvent, date);
switch (date) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/duke/task/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ public Event(String description, String location, String timeStart, String timeE

@Override
public String toString() {
return description + " " + location + " " + " " + timeStart + "-" + timeEnd;
return description + " " + location + " " + timeStart + "-" + timeEnd;
}
}
28 changes: 14 additions & 14 deletions src/main/java/seedu/duke/timetable/Timetable.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import java.util.List;

public class Timetable {
protected ArrayList<Object> monTimetable;
protected ArrayList<Object> tueTimetable;
protected ArrayList<Object> wedTimetable;
protected ArrayList<Object> thuTimetable;
protected ArrayList<Object> friTimetable;
protected ArrayList<Object> satTimetable;
protected ArrayList<Object> sunTimetable;
protected ArrayList<Event> monTimetable;
protected ArrayList<Event> tueTimetable;
protected ArrayList<Event> wedTimetable;
protected ArrayList<Event> thuTimetable;
protected ArrayList<Event> friTimetable;
protected ArrayList<Event> satTimetable;
protected ArrayList<Event> sunTimetable;

public Timetable() {
this.monTimetable = new ArrayList<>();
Expand All @@ -24,31 +24,31 @@ public Timetable() {
this.sunTimetable = new ArrayList<>();
}

public ArrayList<Object> getMonTimetable() {
public ArrayList<Event> getMonTimetable() {
return monTimetable;
}

public ArrayList<Object> getTueTimetable() {
public ArrayList<Event> getTueTimetable() {
return tueTimetable;
}

public ArrayList<Object> getWedTimetable() {
public ArrayList<Event> getWedTimetable() {
return wedTimetable;
}

public ArrayList<Object> getThuTimetable() {
public ArrayList<Event> getThuTimetable() {
return thuTimetable;
}

public ArrayList<Object> getFriTimetable() {
public ArrayList<Event> getFriTimetable() {
return friTimetable;
}

public ArrayList<Object> getSatTimetable() {
public ArrayList<Event> getSatTimetable() {
return satTimetable;
}

public ArrayList<Object> getSunTimetable() {
public ArrayList<Event> getSunTimetable() {
return sunTimetable;
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/duke/ui/Ui.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void printList(UserList users, User nowUser, String day) throws DukeExcep
}
}

ArrayList<Object> timetable = null;
ArrayList<Event> timetable = null;
switch (day) {
case "mon":
timetable = (users.getUser(userIndex).getTimetable()).getMonTimetable();
Expand Down

0 comments on commit bb8ab2a

Please sign in to comment.