Package amadeus.perception
Class Parser
java.lang.Object
amadeus.perception.Parser
Handles the parsing of user input into executable commands.
This class interprets the user's input and maps it to the appropriate Command object,
which can then be executed to perform the desired action. It supports a variety of commands, including
adding tasks, marking tasks as complete, searching for tasks, and more.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringConstant representing the "bye" command.static final StringConstant representing the "check" command.static final StringConstant representing the "commands" command.static final StringConstant representing the "deadline" command.static final StringConstant representing the "delete" command.static final StringConstant representing the "event" command.static final StringConstant representing the "find" command.static final StringConstant representing the "list" command.static final StringConstant representing the "mark" command.static final StringConstant representing the "reset" command.static final StringConstant representing the "todo" command.static final StringConstant representing the "unmark" command. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
BYE_COMMAND
Constant representing the "bye" command.- See Also:
-
COMMAND_LIST
Constant representing the "commands" command.- See Also:
-
LIST_COMMAND
Constant representing the "list" command.- See Also:
-
FIND_COMMAND
Constant representing the "find" command.- See Also:
-
CHECK_COMMAND
Constant representing the "check" command.- See Also:
-
MARK_COMMAND
Constant representing the "mark" command.- See Also:
-
UNMARK_COMMAND
Constant representing the "unmark" command.- See Also:
-
DELETE_COMMAND
Constant representing the "delete" command.- See Also:
-
RESET_COMMAND
Constant representing the "reset" command.- See Also:
-
DEADLINE_COMMAND
Constant representing the "deadline" command.- See Also:
-
EVENT_COMMAND
Constant representing the "event" command.- See Also:
-
TODO_COMMAND
Constant representing the "todo" command.- See Also:
-
-
Constructor Details
-
Parser
public Parser()
-
-
Method Details
-
parse
Parses the user's input and returns the correspondingCommandobject.The input is split into a command and an optional argument. The command is then matched against predefined constants to determine the appropriate action.
- Parameters:
input- the full command input provided by the user; must not benull.- Returns:
- the corresponding
Commandobject. - Throws:
AmadeusException- if the command is invalid or the input cannot be parsed.
-