Skip to content

Commit

Permalink
Merge pull request #14 from AY1920S1-CS2113T-F14-3/master
Browse files Browse the repository at this point in the history
Pull
  • Loading branch information
calebtay authored Oct 20, 2019
2 parents 8ab5832 + 8312555 commit 05cfc2a
Show file tree
Hide file tree
Showing 18 changed files with 303 additions and 279 deletions.
13 changes: 6 additions & 7 deletions src/main/java/CustomExceptions/RoomShareException.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
public class RoomShareException extends Exception {
private static final String outOfBounds_Text = "Index is out of Bounds!";
private static final String anomaly_Text = "Anomaly Detected";
private static final String emptylist_Text = "List is empty";
private static final String timeclash_Text = "Time Clash Detected";
private static final String emptyList_Text = "List is empty";
private static final String timeClash_Text = "Time Clash Detected";
private static final String wrongFormat_Text = "Wrong Format Detected";
private static final String wrongPriority_Text = "Wrong Priority Detected";
private static final String subTask_Text = "Meetings do not support Subtasks";
Expand All @@ -18,13 +18,12 @@ public class RoomShareException extends Exception {
*/
public RoomShareException(ExceptionType type){
switch(type) {
case emptylist:
System.out.println(emptylist_Text);
case emptyList:
System.out.println(emptyList_Text);
break;

case timeClash:
System.out.println(timeclash_Text);
break;
System.out.println(timeClash_Text);

case wrongFormat:
System.out.println(wrongFormat_Text);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/Enums/ExceptionType.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package Enums;

public enum ExceptionType {
timeClash, emptylist, wrongFormat, empty, outOfBounds, wrongPriority, test, subTask
timeClash, emptyList, wrongFormat, empty, outOfBounds, wrongPriority, test, subTask
}
2 changes: 1 addition & 1 deletion src/main/java/Enums/TimeUnit.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package Enums;

public enum TimeUnit {
month, day, hours, minutes
month, day, hours, minutes, unDefined
}
6 changes: 0 additions & 6 deletions src/main/java/Model_Classes/Assignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,6 @@ public class Assignment extends Task {
*/
public Assignment (String description, Date by) {
super(description, by);
//super.by = by;
//this.isFixedDuration = false;
}

public Assignment (String description, String duration, TimeUnit unit) {
super(description, null);
}

/**
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/Model_Classes/FixedDuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
public class FixedDuration extends Meeting {
private String duration;
private String unit;
private Date at;

/**
* Constructor for fixed duration
Expand All @@ -27,6 +26,10 @@ public String getDuration(){
return duration;
}

/**
* Return time unit of the duration of event
* @return time unit of the duration of event
*/
public String getUnit() {
return unit;
}
Expand Down
13 changes: 6 additions & 7 deletions src/main/java/Model_Classes/Meeting.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
*/
public class Meeting extends Task {
private boolean isFixedDuration;
private String duration;
private TimeUnit timeUnit;
private int duration = 0;
private TimeUnit timeUnit = TimeUnit.unDefined;
/**
* Constructor for Event object
* Takes in inputs for description of the event and the time the event occurs
Expand All @@ -19,12 +19,11 @@ public class Meeting extends Task {
*/
public Meeting(String description, Date at) {
super(description, at);
//this.at = at;
this.isFixedDuration = false;
}

public Meeting (String description, String duration, TimeUnit unit) {
super(description, null);
public Meeting (String description, Date date, int duration, TimeUnit unit) {
super(description, date);
this.duration = duration;
this.timeUnit = unit;
this.isFixedDuration = true;
Expand All @@ -37,7 +36,7 @@ public Meeting (String description, String duration, TimeUnit unit) {
@Override
public String toString() {
if (isFixedDuration){
return "[M]" + super.toString() + " (in: " + duration + " " + timeUnit.toString() + ")";
return "[M]" + super.toString() + " (on: " + super.getDate() + ") (duration: " + duration + " " + timeUnit.toString() + ")";
} else {
return "[M]" + super.toString() + " (on: " + super.getDate() + ")";
}
Expand All @@ -48,7 +47,7 @@ public boolean isFixedDuration() {
}

public String getDuration() {
return duration;
return Integer.toString(duration);
}

public TimeUnit getTimeUnit() {
Expand Down
23 changes: 14 additions & 9 deletions src/main/java/Model_Classes/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public Task(String description, Date time) {
this.isDone = false;
this.priority = Priority.low;
this.time = time;
this.user = "everyone";
this.recurrenceSchedule = RecurrenceScheduleType.none;
}

/**
Expand All @@ -45,7 +47,7 @@ public String getUser() {
* @return time the task was created
*/

public void setUser(String user) {
public void setAssignee(String user) {
this.user = user;
}

Expand All @@ -57,6 +59,13 @@ public boolean getDone() {
return isDone;
}

/**
* Sets the task to be done
*/
public void setDone(boolean done) {
isDone = done;
}

/**
* Returns the status of the completion of the task.
* shows a tick if done, and a cross if not done.
Expand All @@ -78,13 +87,6 @@ public String getDescription() {
*/
public Priority getPriority() { return priority; }

/**
* Sets the task to be done
*/
public void setDone(boolean done) {
isDone = done;
}

/**
* Sets the priority of the task
* @param p priority of the task
Expand Down Expand Up @@ -114,6 +116,10 @@ public void setRecurrenceSchedule(RecurrenceScheduleType recurrenceSchedule) {
}
}

/**
* Return whether the task is recurred
* @return hasRecurring: whether the task is recurred
*/
public boolean hasRecurring() {
return hasRecurring;
}
Expand Down Expand Up @@ -157,5 +163,4 @@ public void snoozeHour(int amount){
public void snoozeMinute(int amount){
this.time.setMinutes(this.time.getMinutes() + amount);
}

}
4 changes: 4 additions & 0 deletions src/main/java/Operations/Help.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ public void showHelp(String keyword) {
break;
}
}

public void helpCommandList() {
ui.helpList();
}
}
8 changes: 6 additions & 2 deletions src/main/java/Operations/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ public Parser() {
}

/**
* Returns the command that the user has given Duke.
* @return command The command given by the user to Duke.
* Returns the command that the user has given RoomShare
* @return command The command given by the user to RoomShare
*/
public String getCommand() {
String command = scanner.next().toLowerCase().trim();
return command;
}

/**
* Return the line of command that the user has given Duke
* @return command The line of command given by the user to RoomShare
*/
public String getCommandLine() {
String command = scanner.nextLine().toLowerCase().trim();
return command;
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/Operations/RecurHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,14 @@ public boolean checkRecurrence() {
Assignment recurringAssignment= new Assignment(description, getNewDate(check));
recurringAssignment.setRecurrenceSchedule(type);
recurringAssignment.setPriority(check.getPriority());
recurringAssignment.setUser(check.getUser());
recurringAssignment.setAssignee(check.getUser());
taskList.replace(index, recurringAssignment);
isEdited = true;
} else {
Meeting recurringMeeting= new Meeting(description, getNewDate(check));
recurringMeeting.setRecurrenceSchedule(type);
recurringMeeting.setPriority(check.getPriority());
recurringMeeting.setUser(check.getUser());
recurringMeeting.setAssignee(check.getUser());
taskList.replace(index, recurringMeeting);
isEdited = true;
}
Expand Down
Loading

0 comments on commit 05cfc2a

Please sign in to comment.