1212import chingu .exception .NoCommandException ;
1313import chingu .exception .ToDosException ;
1414import chingu .exception .EventException ;
15- import chingu .task .TaskList ;
1615import chingu .task .Task ;
1716import chingu .task .Event ;
1817import chingu .task .Deadline ;
@@ -41,6 +40,13 @@ public static Command parse(String fullCommand) throws NoCommandException {
4140 }
4241 }
4342
43+ /**
44+ * Sorts the 1-word Command from the user
45+ *
46+ * @param fullCommand from the user
47+ * @return Command that is constructed based on User's command
48+ * @throws NoCommandException if no command is present
49+ */
4450 public static Command parseOneWordCommand (String fullCommand ) throws NoCommandException {
4551 if (fullCommand .equals ("list" )) {
4652 return new ListCommand ();
@@ -72,6 +78,13 @@ public static Command parseLongCommand(String firstWord, String furtherDetails)
7278 }
7379 }
7480
81+ /**
82+ * Parse Command that adds ToDo
83+ *
84+ * @param description about ToDo
85+ * @return ToDo Task that is created
86+ * @throws ToDosException if necessary details are missing from the ToDo
87+ */
7588 public static Task parseToDos (String description ) throws ToDosException {
7689 if (description .isEmpty ()) {
7790 throw new ToDosException ("What todos do you need to record?" );
@@ -86,6 +99,14 @@ public static Task parseToDos(String description) throws ToDosException {
8699 return new ToDo (description , priority );
87100 }
88101
102+ /**
103+ * Parse Command that adds Deadline
104+ *
105+ * @param description about Deadline
106+ * @return Deadline that is created
107+ * @throws DeadlineException if necessary details are missing from the Deadline
108+ * @throws DateException if format of the date given is wrong
109+ */
89110 public static Task parseDeadline (String description ) throws DeadlineException , DateException {
90111 if (description .isEmpty ()) {
91112 throw new DeadlineException ("What deadline do you need to record?" );
@@ -107,6 +128,13 @@ public static Task parseDeadline(String description) throws DeadlineException, D
107128 return new Deadline (D , by , priority );
108129 }
109130
131+ /**
132+ * Parse Command taht adds Event
133+ *
134+ * @param description about Event
135+ * @return Event that is created
136+ * @throws EventException if necessary details are missing from the Event
137+ */
110138 public static Task parseEvent (String description ) throws EventException {
111139 if (description .isEmpty ()) {
112140 throw new EventException ("What event do you need to record?" );
@@ -127,6 +155,12 @@ public static Task parseEvent(String description) throws EventException {
127155 return new Event (D , from , to , priority );
128156 }
129157
158+ /**
159+ * Check if the description is splitted correctly
160+ *
161+ * @param length number of splitted descriptions
162+ * @throws DeadlineException if necessary details are missing from the Deadline
163+ */
130164 public static void checkDeadlineSplit (int length ) throws DeadlineException {
131165 if (length < 2 ) {
132166 throw new DeadlineException ("Please insert the priority of the task - /priority High/Mid/low" );
@@ -139,6 +173,12 @@ public static void checkEventSplit(int length) throws EventException{
139173 }
140174 }
141175
176+ /**
177+ * Validate if the format of the event dates are correctly added by the user
178+ *
179+ * @param from - start date of the event
180+ * @param to - end date of the event
181+ */
142182 public static void validateDates (String from , String to ) {
143183 boolean validateFromDate = from .matches ("[0-9]{4}/[0-9]{2}/[0-9]{2}\\ [0-9]{4}" );
144184 assert !validateFromDate : "format of the event start date is WRONG!" ;
0 commit comments