forked from nus-cs2103-AY2324S1/ip
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed styling and added more javadoc
- Loading branch information
1 parent
d0e7202
commit 72e7ee1
Showing
11 changed files
with
118 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,50 @@ | ||
package duke; | ||
|
||
/** | ||
* Class to determine EventTypeHandler | ||
*/ | ||
public class EventTypeHandler { | ||
private TaskList tasks; | ||
private String extractedSubstring; | ||
private String isDone; | ||
|
||
/** | ||
* Constructor for eventHandler | ||
* @param tasks TaskList | ||
* @param extractedSubstring Substring to determine which type of event | ||
* @param isDone whether the event is marked as done or not | ||
*/ | ||
public EventTypeHandler(TaskList tasks, String extractedSubstring, String isDone) { | ||
this.tasks = tasks; | ||
this.extractedSubstring = extractedSubstring; | ||
this.isDone = isDone; | ||
} | ||
|
||
/** | ||
* To handle the different type of tasks (T,D,E) | ||
* @param eventType | ||
* @throws EmptyDescriptionException | ||
*/ | ||
public void handleEventType(String eventType) throws EmptyDescriptionException { | ||
switch (eventType) { | ||
case "T": { | ||
tasks.toDoHandler(extractedSubstring, isDone.equals("X"), true); | ||
break; | ||
} | ||
case "D": { | ||
//System.out.println(extractedSubstring); | ||
String description = Parser.convertDeadlineFormat(extractedSubstring); | ||
tasks.deadlineHandler(description, isDone.equals("X"), true); | ||
break; | ||
} | ||
case "E": { | ||
String description = Parser.convertEventFormat(extractedSubstring); | ||
tasks.eventHandler(description, isDone.equals("X"), true); | ||
break; | ||
} | ||
default: { | ||
break; | ||
} | ||
case "T": { | ||
tasks.toDoHandler(extractedSubstring, isDone.equals("X"), true); | ||
break; | ||
} | ||
case "D": { | ||
//System.out.println(extractedSubstring); | ||
String description = Parser.convertDeadlineFormat(extractedSubstring); | ||
tasks.deadlineHandler(description, isDone.equals("X"), true); | ||
break; | ||
} | ||
case "E": { | ||
String description = Parser.convertEventFormat(extractedSubstring); | ||
tasks.eventHandler(description, isDone.equals("X"), true); | ||
break; | ||
} | ||
default: { | ||
break; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters