forked from AY2324S2-CS2103T-T08-1/tp
-
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.
Merge pull request AY2324S2-CS2103T-T08-1#57 from laney0808/update-cr…
…eate-commands Update create command and delete command
- Loading branch information
Showing
44 changed files
with
388 additions
and
285 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
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 |
---|---|---|
|
@@ -2,9 +2,18 @@ | |
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_ALLERGIES; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_BLOODTYPE; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_CONDITION; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_DATEOFBIRTH; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_DIAGNOSIS; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_NRIC; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_SEX; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_STATUS; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_SYMPTOM; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; | ||
|
||
import seedu.address.commons.util.ToStringBuilder; | ||
|
@@ -16,37 +25,51 @@ | |
/** | ||
* Adds a person to the address book. | ||
*/ | ||
public class AddCommand extends Command { | ||
public static final String COMMAND_WORD = "add"; | ||
public class CreateCommand extends Command { | ||
public static final String COMMAND_WORD = "create"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to the address book. " | ||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Creates a patient to the Immunimate System. " | ||
+ "Parameters: " | ||
+ PREFIX_NRIC + "NRIC " | ||
+ PREFIX_NAME + "NAME " | ||
+ PREFIX_PHONE + "PHONE " | ||
+ PREFIX_EMAIL + "EMAIL " | ||
+ PREFIX_ADDRESS + "ADDRESS " | ||
+ PREFIX_DATEOFBIRTH + "DATEOFBIRTH " | ||
+ PREFIX_SEX + "SEX " | ||
+ PREFIX_STATUS + "STATUS " | ||
+ PREFIX_EMAIL + "EMAIL " | ||
+ "[" + PREFIX_TAG + "TAG]...\n" | ||
+ PREFIX_ALLERGIES + "ALLERGIES " | ||
+ PREFIX_BLOODTYPE + "BLOODTYPE " | ||
+ PREFIX_CONDITION + "CONDITION " | ||
+ PREFIX_SYMPTOM + "SYMPTOM " | ||
+ PREFIX_DIAGNOSIS + "DIAGNOSIS " | ||
+ "Example: " + COMMAND_WORD + " " | ||
+ PREFIX_NRIC + "S1234567A " | ||
+ PREFIX_NAME + "John Doe " | ||
+ PREFIX_PHONE + "98765432 " | ||
+ PREFIX_EMAIL + "[email protected] " | ||
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 " | ||
+ PREFIX_TAG + "friends " | ||
+ PREFIX_TAG + "owesMoney"; | ||
+ PREFIX_DATEOFBIRTH + "01-01-1990 " | ||
+ PREFIX_SEX + "M " | ||
+ PREFIX_STATUS + "PENDING " | ||
+ PREFIX_TAG + "Long term medication " | ||
+ PREFIX_TAG + "High blood pressure "; | ||
|
||
public static final String MESSAGE_SUCCESS = "New person added: %1$s"; | ||
public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book"; | ||
public static final String MESSAGE_SUCCESS = "New patient added: %1$s"; | ||
public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the system"; | ||
|
||
private final Person toAdd; | ||
|
||
/** | ||
* Creates an AddCommand to add the specified {@code Person} | ||
*/ | ||
public AddCommand(Person person) { | ||
public CreateCommand(Person person) { | ||
requireNonNull(person); | ||
toAdd = person; | ||
} | ||
|
||
//TODO test cases | ||
@Override | ||
public CommandResult execute(Model model) throws CommandException { | ||
requireNonNull(model); | ||
|
@@ -66,12 +89,12 @@ public boolean equals(Object other) { | |
} | ||
|
||
// instanceof handles nulls | ||
if (!(other instanceof AddCommand)) { | ||
if (!(other instanceof CreateCommand)) { | ||
return false; | ||
} | ||
|
||
AddCommand otherAddCommand = (AddCommand) other; | ||
return toAdd.equals(otherAddCommand.toAdd); | ||
CreateCommand otherCreateCommand = (CreateCommand) other; | ||
return toAdd.equals(otherCreateCommand.toAdd); | ||
} | ||
|
||
@Override | ||
|
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
Oops, something went wrong.