Skip to content

Commit

Permalink
Added collate for Schedule
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfjw committed Nov 6, 2016
1 parent 495cd68 commit bba15ef
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/main/java/seedu/taskman/model/event/Schedule.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public String toString() {
public static final String ERROR_FORMAT_BAD_DURATION = String.format(Messages.MESSAGE_INVALID_ARGUMENTS,
"Bad duration, %1$s");

//@@author A0139019E
private static final String SCHEDULE_DIVIDER_GROUP = "((?:, )|(?: to )|(?: for ))";
private static final String SCHEDULE_VALIDATION_REGEX = "(.*?)" + SCHEDULE_DIVIDER_GROUP + "(.*)";

Expand All @@ -72,13 +73,10 @@ public Schedule(long startEpochSecond, long endEpochSecond) throws IllegalValueE
* Parses a string in natural language to create a schedule object
* A schedule consists of a start & end time
*
* Three formats are accepted:
* "start time, end time",
* "start time to end time",
* "start time for duration"
* Refer to Schedule.MESSAGE_SCHEDULE_CONSTRAINS for accepted formats
*
* @throws IllegalValueException when input strays from the formats,
* or when the start/end time/duration cannot be parsed
* @throws IllegalValueException when input strays from the accepted formats,
* or when the start,end time or duration cannot be parsed
*/
public Schedule(String schedule) throws IllegalValueException {
schedule = schedule.trim();
Expand Down Expand Up @@ -168,6 +166,8 @@ private long convertRawDurationToEndTime(String rawDuration, long startEpochSeco
}
}

//@@author

@Override
public String toString() {
return Formatter.appendWithNewlines(
Expand Down Expand Up @@ -270,6 +270,7 @@ public String getFormalEndString(){
return DateTimeParser.epochSecondToFormalDateTime(endEpochSecond);
}

//@@author A0139019E
@Override
public boolean equals(Object o) {
if (this == o) return true;
Expand All @@ -284,4 +285,5 @@ public int hashCode() {
return Objects.hashCode(startEpochSecond, endEpochSecond);
}

//@@author
}

0 comments on commit bba15ef

Please sign in to comment.