Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
tyeryan authored Nov 10, 2019
2 parents 5639911 + 6a443cd commit 03b24ee
Show file tree
Hide file tree
Showing 30 changed files with 752 additions and 643 deletions.
6 changes: 3 additions & 3 deletions RoomShare.iws
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,23 @@
<breakpoints>
<line-breakpoint enabled="true" type="java-method">
<url>file://$PROJECT_DIR$/src/test/java/TaskListTest.java</url>
<line>39</line>
<line>38</line>
<properties class="TaskListTest" method="add">
<option name="EMULATED" value="true" />
</properties>
<option name="timeStamp" value="2" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-method">
<url>file://$PROJECT_DIR$/src/test/java/TaskListTest.java</url>
<line>93</line>
<line>92</line>
<properties class="TaskListTest" method="reorder">
<option name="EMULATED" value="true" />
</properties>
<option name="timeStamp" value="3" />
</line-breakpoint>
<line-breakpoint enabled="true" type="java-line">
<url>file://$PROJECT_DIR$/src/test/java/TaskListTest.java</url>
<line>107</line>
<line>106</line>
<option name="timeStamp" value="4" />
</line-breakpoint>
</breakpoints>
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/CustomExceptions/DuplicateException.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,19 @@ public class DuplicateException extends Exception {
private String message;

/**
* Adds the appropriate index to the Duplicate task message
* Adds the appropriate index to the Duplicate task message.
* @param index index of the task with the clash
*/
public DuplicateException(int index) {
message = DUPLICATE_TASK + "Task: " + (index+1) + "\n";
message = DUPLICATE_TASK + "Task: " + (index + 1) + "\n";
}

/**
* toString() method returning the message of the Exception
* toString() method returning the message of the Exception.
* @return the message of the Exception
*/
@Override
public String toString(){
public String toString() {
return LINE + message + LINE;
}
}
59 changes: 34 additions & 25 deletions src/main/java/CustomExceptions/RoomShareException.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,42 @@ public class RoomShareException extends Exception {
private static final String WRONG_FORMAT_TEXT = "\tWrong Format Detected\n";
private static final String WRONG_PRIORITY_TEXT = "\tYou've entered wrong format of priority\n";
private static final String SUB_TASK_TEXT = "\tOnly Assignments are supported with Subtasks\n";
public static final String WRONG_TASK_TYPE_TEXT = "\tOnly meeting, assignment, or leave tag are accepted\n";
public static final String EMPTY_DESCRIPTION_TEXT = "\tYou haven't included the description of you task\n";
public static final String EMPTY_DATE_TEXT = "\tYou haven't included the date of your task\n";
public static final String EMPTY_USER_TEXT = "\tYou haven't included the user of your task\n";
public static final String EMPTY_TASK_TYPE_TEXT = "\tYou haven't specified the type of your task: assignment, meeting, or leave\n";
public static final String WRITE_ERROR_TEXT = "\tError in writing file, cancelling write process...\n";
public static final String WRONG_INDEX_FORMAT_TEXT = "\tThe index you've enter is in the wrong format\n";
public static final String WRONG_TIME_FORMAT_TEXT = "\tYou've entered an invalid time format\n";
public static final String WRONG_SORT_TYPE_TEXT = "\tPlease enter a valid sort type: priority, alphabetical or deadline\n";
public static final String LOG_ERROR_TEXT = "\tError writing to a new log file. Please try again.\n";
public static final String NEGATIVE_AMOUNT_TEXT = "\tThe amount of time cannot be negative.\n";
public static final String EMPTY_SUB_TASK = "\tYou haven't included your list of sub-tasks\n";
public static final String DUPLICATE_SUB = "\tDuplicate subtask detected\n";
public static final String LEAVE_DONE = "\tLeave cannot be set to done\n";
public static final String INVALID_INPUT_TEXT = "\tYour input String seems to be wrong.\n"
+"\tPlease check your formatting and ensure that the use of special characters are correct!\n";
public static final String LOAD_ERROR_MESSAGE = "\terror in loading file: will be initialising empty list instead!\n";
public static final String INVALID_DATE_MESSAGE = "\tThe date you've input is before the current date!\n";
public static final String WRONG_DATE_FORMAT_TEXT = "\tYou've entered invalid date or time\n";
public static final String EMPTY_INDEX = "\tPlease enter a valid index within the range of the list! Eg. restore 1\n";
private static final String WRONG_TASK_TYPE_TEXT = "\tOnly meeting, assignment, or leave tag are accepted\n";
private static final String EMPTY_DESCRIPTION_TEXT = "\tYou haven't included the description of you task\n";
private static final String EMPTY_DATE_TEXT = "\tYou haven't included the date of your task\n";
private static final String EMPTY_USER_TEXT = "\tYou haven't included the user of your task\n";
private static final String EMPTY_TASK_TYPE_TEXT = "\tYou haven't specified the type of your task: assignment, meeting, or leave\n";
private static final String WRITE_ERROR_TEXT = "\tError in writing file, cancelling write process...\n";
private static final String WRONG_INDEX_FORMAT_TEXT = "\tThe index you've enter is in the wrong format\n";
private static final String WRONG_TIME_FORMAT_TEXT = "\tYou've entered an invalid time format\n";
private static final String WRONG_SORT_TYPE_TEXT = "\tPlease enter a valid sort type: "
+ "priority, alphabetical or deadline\n";
private static final String LOG_ERROR_TEXT = "\tError writing to a new log file. Please try again.\n";
private static final String NEGATIVE_AMOUNT_TEXT = "\tThe amount of time cannot be negative.\n";
private static final String EMPTY_SUB_TASK = "\tYou haven't included your list of sub-tasks\n";
private static final String DUPLICATE_SUB = "\tDuplicate subtask detected\n";
private static final String LEAVE_DONE = "\tLeave cannot be set to done\n";
private static final String INVALID_INPUT_TEXT = "\tYour input String seems to be wrong.\n"
+ "\tPlease check your formatting and ensure that the use of special characters are correct!\n";
private static final String LOAD_ERROR_MESSAGE = "\terror in loading file: will be initialising empty list instead!\n";
private static final String INVALID_DATE_MESSAGE = "\tThe date you've input is before the current date!\n";
private static final String WRONG_DATE_FORMAT_TEXT = "\tYou've entered invalid date or time\n";
private static final String EMPTY_INDEX = "\tPlease enter a valid index within the range of the list! Eg. reopen 1\n";
private static final String INVALID_LEAVE_DATE_MESSAGE = "\tPlease check your dates for your leave!\n";
private static final String NO_SUCH_SUBTASK = "\tSubtask does not exist!\n";
private static final String ASSIGNEE_SET_TO_EVERYONE = "\tThere might have been an error when setting the assignee\n"
+ "\tIt could be an error in your entry of the assignee field\n"
+ "\tHowever, if you had intended to set the assignee to 'everyone', then ignore this message\n";

private String message;

/**
* Constructor for DukeException Exception
* Constructor for DukeException Exception.
* Takes in the exception type thrown and prints out the specific error message
* @param type type of exception detected
*/
public RoomShareException(ExceptionType type){
switch(type) {
public RoomShareException(ExceptionType type) {
switch (type) {

case emptyUser:
message = EMPTY_USER_TEXT;
Expand Down Expand Up @@ -147,18 +152,22 @@ public RoomShareException(ExceptionType type){
message = NO_SUCH_SUBTASK;
break;

case assigneeSetToEveyone:
message = ASSIGNEE_SET_TO_EVERYONE;
break;

default:
message = ANOMALY_TEXT;
break;
}
}

/**
* toString() method returning the message of the Exception
* toString() method returning the message of the Exception.
* @return the message of the Exception
*/
@Override
public String toString(){
public String toString() {
return LINE + message + LINE;
}
}
8 changes: 4 additions & 4 deletions src/main/java/CustomExceptions/TimeClashException.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ public class TimeClashException extends Exception {
private String message;

/**
* TimeClashException constructor
* TimeClashException constructor.
* Adds the appropriate index to the time clash message
* @param index index of task with the clash
*/
public TimeClashException(int index) {
message = TIME_CLASH_TEXT + "Task: " + (index+1) + "\n";
message = TIME_CLASH_TEXT + "Task: " + (index + 1) + "\n";
}

/**
* toString() method returning the message of the Exception
* toString() method returning the message of the Exception.
* @return the message of the Exception
*/
@Override
public String toString(){
public String toString() {
return LINE + message + LINE;
}
}
60 changes: 28 additions & 32 deletions src/main/java/Enums/ExceptionType.java
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
package Enums;

public enum ExceptionType {
wrongTimeFormat,
wrongIndexFormat,
wrongSortFormat,
wrongTaskType,
wrongFormat,
wrongPriority,
wrongDateFormat,
negativeTimeAmount,

timeClash,
emptyList,
emptyUser,
outOfBounds,
emptySubTask,

leaveDone,
subTaskError,
duplicateSubtask,

emptyDescription,
emptyDate,
emptyTaskType,

logError,
writeError,
loadError,

invalidInputString,
invalidDateRange,
emptyIndex,
noSubtask, invalidDateError
}
wrongTimeFormat,
wrongIndexFormat,
wrongSortFormat,
wrongTaskType,
wrongFormat,
wrongPriority,
wrongDateFormat,
negativeTimeAmount,
emptyList,
emptyUser,
outOfBounds,
emptySubTask,
leaveDone,
subTaskError,
duplicateSubtask,
emptyDescription,
emptyDate,
emptyTaskType,
logError,
writeError,
loadError,
invalidInputString,
invalidDateRange,
emptyIndex,
noSubtask,
invalidDateError,
assigneeSetToEveyone
}
5 changes: 0 additions & 5 deletions src/main/java/Enums/HelpType.java

This file was deleted.

5 changes: 0 additions & 5 deletions src/main/java/Enums/ReplyType.java

This file was deleted.

5 changes: 0 additions & 5 deletions src/main/java/Enums/ReportType.java

This file was deleted.

25 changes: 23 additions & 2 deletions src/main/java/Enums/TaskType.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
package Enums;

public enum TaskType {
list, bye, find, done , delete, time, snooze, others, help, priority, reorder,
restore, add, subtask, update, sort, log, overdue, reschedule, completed, show, removeoverdue
list,
bye,
find,
done,
delete,
time,
snooze,
others,
help,
priority,
reorder,
restore,
add,
subtask,
update,
sort,
log,
overdue,
reschedule,
completed,
show,
removeoverdue,
reopen
}
24 changes: 15 additions & 9 deletions src/main/java/Model_Classes/Assignment.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,47 @@
* Stores the description and when the task should be done by.
*/
public class Assignment extends Task {

private ArrayList<String> subTasks = new ArrayList<String>();

/**
* Constructor for the Assignment object.
* Takes in inputs for description and date/time the tasks should be done by.
* @param description Description of the task
* @param by The time the tasks should be done by.
*/
public Assignment (String description, Date by) {
public Assignment(String description, Date by) {
super(description, by);
}

/**
* Takes in arraylist of subtasks and sets it as this assignment's subtasks
* Takes in arraylist of subtasks and sets it as this assignment's subtasks.
* @param addList array list containing subtasks
*/
public void addSubTasks(ArrayList<String> addList) {
for(String output : addList) {
for (String output : addList) {
subTasks.add(output);
}
}

/**
* Takes in a String, splits it by "," and sets each new String as a subtask of current Task
* Takes in a String, splits it by "," and sets each new String as a subtask of current Task.
* @param subTasks string containing subtasks
*/
public void addSubTasks(String subTasks) { this.subTasks = new ArrayList<>(Arrays.asList(subTasks.trim().split(","))); }
public void addSubTasks(String subTasks) {
this.subTasks = new ArrayList<>(Arrays.asList(subTasks.trim().split(",")));
}

/**
* Returns the ArrayList containing the Assignment's subtasks
* @return ArrayList<String> subtasks.
* Returns the ArrayList containing the Assignment's subtasks.
* @return ArrayList of subtasks as Strings
*/
public ArrayList<String> getSubTasks() { return subTasks; }
public ArrayList<String> getSubTasks() {
return subTasks;
}

/**
* Removes completed Subtask
* Removes completed Subtask.
* @param index index of completed subtask
* @throws RoomShareException when there is no subtask at that index
*/
Expand Down
Loading

0 comments on commit 03b24ee

Please sign in to comment.