From b2fbc6e774295035f05c8ba8e4b054f939d7e17e Mon Sep 17 00:00:00 2001 From: CaptainKeqing <96646939+CaptainKeqing@users.noreply.github.com> Date: Mon, 15 Apr 2024 02:16:51 +0800 Subject: [PATCH 1/2] Use InternshipParserUtil common static function --- .../logic/parser/InternshipEditCommandParser.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/seedu/address/logic/parser/InternshipEditCommandParser.java b/src/main/java/seedu/address/logic/parser/InternshipEditCommandParser.java index 7d62b7e8a13..9864f36d40c 100755 --- a/src/main/java/seedu/address/logic/parser/InternshipEditCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/InternshipEditCommandParser.java @@ -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; @@ -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, @@ -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()); - } } From 9a0d8d09520c2c9ab6a5e45b45d342c87f17038a Mon Sep 17 00:00:00 2001 From: CaptainKeqing <96646939+CaptainKeqing@users.noreply.github.com> Date: Mon, 15 Apr 2024 02:17:08 +0800 Subject: [PATCH 2/2] Remove stray comment --- .../address/logic/parser/InternshipRemarkCommandParser.java | 1 - 1 file changed, 1 deletion(-) diff --git a/src/main/java/seedu/address/logic/parser/InternshipRemarkCommandParser.java b/src/main/java/seedu/address/logic/parser/InternshipRemarkCommandParser.java index 70285ea2675..0a67595d645 100644 --- a/src/main/java/seedu/address/logic/parser/InternshipRemarkCommandParser.java +++ b/src/main/java/seedu/address/logic/parser/InternshipRemarkCommandParser.java @@ -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);