Skip to content

Commit

Permalink
Merge pull request #301 from CaptainKeqing/codeQualityParser
Browse files Browse the repository at this point in the history
Code quality parser improvments
  • Loading branch information
jieqiboh authored Apr 14, 2024
2 parents 7478768 + 9a0d8d0 commit 6728448
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
import static seedu.address.logic.parser.CliSyntax.PREFIX_REMARK;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ROLE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS;

import java.util.stream.Stream;
import static seedu.address.logic.parser.InternshipParserUtil.anyPrefixesPresent;

import seedu.address.commons.core.index.Index;
import seedu.address.logic.commands.InternshipEditCommand;
Expand All @@ -39,7 +38,7 @@ public InternshipEditCommand parse(String args) throws ParseException {

Index index;

if (!areAnyPrefixesPresent(argMultimap, PREFIX_COMPANY, PREFIX_DESCRIPTION, PREFIX_STATUS, PREFIX_CONTACT_NAME,
if (!anyPrefixesPresent(argMultimap, PREFIX_COMPANY, PREFIX_DESCRIPTION, PREFIX_STATUS, PREFIX_CONTACT_NAME,
PREFIX_CONTACT_EMAIL, PREFIX_CONTACT_NUMBER, PREFIX_LOCATION, PREFIX_ROLE, PREFIX_REMARK)
|| argMultimap.getPreamble().isEmpty()) {
throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT,
Expand Down Expand Up @@ -100,8 +99,4 @@ public InternshipEditCommand parse(String args) throws ParseException {

return new InternshipEditCommand(index, editInternshipDescriptor);
}

private static boolean areAnyPrefixesPresent(ArgumentMultimap argumentMultimap, Prefix... prefixes) {
return Stream.of(prefixes).anyMatch(prefix -> argumentMultimap.getValue(prefix).isPresent());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class InternshipRemarkCommandParser {
* @throws ParseException if the user input does not conform the expected format
*/
public InternshipRemarkCommand parse(String args) throws ParseException {
// addremark 1 /remark remark here
requireNonNull(args);
ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, PREFIX_REMARK);

Expand Down

0 comments on commit 6728448

Please sign in to comment.