forked from nus-cs2103-AY2223S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into w11/update-dg
- Loading branch information
Showing
5 changed files
with
93 additions
and
10 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
29 changes: 29 additions & 0 deletions
29
src/main/java/seedu/foodrem/logic/parser/generalcommandparser/ExitCommandParser.java
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package seedu.foodrem.logic.parser.generalcommandparser; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.foodrem.commons.core.Messages; | ||
import seedu.foodrem.logic.commands.generalcommands.ExitCommand; | ||
import seedu.foodrem.logic.parser.Parser; | ||
import seedu.foodrem.logic.parser.exceptions.ParseException; | ||
|
||
/** | ||
* Parses input arguments and creates a ExitCommand object. | ||
*/ | ||
public class ExitCommandParser implements Parser<ExitCommand> { | ||
/** | ||
* Parses the given {@code String} of arguments in the context of the ExitCommand | ||
* and returns an ExitCommand object for execution. | ||
* | ||
* @throws ParseException if the user input does not conform the expected format | ||
*/ | ||
public ExitCommand parse(String args) throws ParseException { | ||
requireNonNull(args); | ||
|
||
if (!args.trim().isBlank()) { | ||
throw new ParseException(String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, ExitCommand.getUsage())); | ||
} | ||
|
||
return new ExitCommand(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/seedu/foodrem/logic/parser/generalcommandparser/ResetCommandParser.java
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package seedu.foodrem.logic.parser.generalcommandparser; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.foodrem.commons.core.Messages; | ||
import seedu.foodrem.logic.commands.generalcommands.ResetCommand; | ||
import seedu.foodrem.logic.parser.Parser; | ||
import seedu.foodrem.logic.parser.exceptions.ParseException; | ||
|
||
/** | ||
* Parses input arguments and creates a ResetCommand object. | ||
*/ | ||
public class ResetCommandParser implements Parser<ResetCommand> { | ||
/** | ||
* Parses the given {@code String} of arguments in the context of the ResetCommand | ||
* and returns an ResetCommand object for execution. | ||
* | ||
* @throws ParseException if the user input does not conform the expected format | ||
*/ | ||
public ResetCommand parse(String args) throws ParseException { | ||
requireNonNull(args); | ||
|
||
if (!args.trim().isBlank()) { | ||
throw new ParseException(String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, ResetCommand.getUsage())); | ||
} | ||
|
||
return new ResetCommand(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/java/seedu/foodrem/logic/parser/itemcommandparser/ListCommandParser.java
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package seedu.foodrem.logic.parser.itemcommandparser; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.foodrem.commons.core.Messages; | ||
import seedu.foodrem.logic.commands.itemcommands.ListCommand; | ||
import seedu.foodrem.logic.parser.Parser; | ||
import seedu.foodrem.logic.parser.exceptions.ParseException; | ||
|
||
/** | ||
* Parses input arguments and creates a ListCommand object. | ||
*/ | ||
public class ListCommandParser implements Parser<ListCommand> { | ||
/** | ||
* Parses the given {@code String} of arguments in the context of the ListCommand | ||
* and returns an ListCommand object for execution. | ||
* | ||
* @throws ParseException if the user input does not conform the expected format | ||
*/ | ||
public ListCommand parse(String args) throws ParseException { | ||
requireNonNull(args); | ||
|
||
if (!args.trim().isBlank()) { | ||
throw new ParseException(String.format(Messages.MESSAGE_INVALID_COMMAND_FORMAT, ListCommand.getUsage())); | ||
} | ||
|
||
return new ListCommand(); | ||
} | ||
} |
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