forked from nus-cs2103-AY1819S2/addressbook-level4
-
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 nus-cs2103-AY1819S2#70 from kylerwsm/classChanges
Class changes
- Loading branch information
Showing
49 changed files
with
567 additions
and
561 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
package seedu.address.logic.commands; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; | ||
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_TAG; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_YEAR; | ||
|
||
import seedu.address.logic.CommandHistory; | ||
|
@@ -23,24 +19,15 @@ public class AddCommand extends Command { | |
|
||
public static final String COMMAND_WORD = "add"; | ||
|
||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a person to the address book. " | ||
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Adds a patient to the dental book. " | ||
+ "Parameters: " | ||
+ PREFIX_NAME + "NAME " | ||
+ PREFIX_NRIC + "NRIC " | ||
+ PREFIX_YEAR + "DOB " | ||
+ PREFIX_PHONE + "PHONE " | ||
+ PREFIX_EMAIL + "EMAIL " | ||
+ PREFIX_ADDRESS + "ADDRESS " | ||
+ "[" + PREFIX_TAG + "TAG]...\n" | ||
+ PREFIX_YEAR + "DOB \n" | ||
+ "Example: " + COMMAND_WORD + " " | ||
+ PREFIX_NAME + "John Doe " | ||
+ PREFIX_NRIC + "S1234567A " | ||
+ PREFIX_YEAR + "30-12-1990 " | ||
+ PREFIX_PHONE + "98765432 " | ||
+ PREFIX_EMAIL + "[email protected] " | ||
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 " | ||
+ PREFIX_TAG + "friends " | ||
+ PREFIX_TAG + "owesMoney"; | ||
+ PREFIX_YEAR + "30-12-1990 "; | ||
|
||
public static final String MESSAGE_SUCCESS = "New patient added: %1$s"; | ||
public static final String MESSAGE_DUPLICATE_PERSON = "This patient already exists in the dental book"; | ||
|
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 |
---|---|---|
|
@@ -4,11 +4,11 @@ | |
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS; | ||
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_TAG; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_YEAR; | ||
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; | ||
|
||
import java.util.Collections; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
import java.util.Optional; | ||
|
@@ -20,7 +20,7 @@ | |
import seedu.address.logic.CommandHistory; | ||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.patient.DateOfBirth; | ||
import seedu.address.model.datetime.DateOfBirth; | ||
import seedu.address.model.patient.Nric; | ||
import seedu.address.model.patient.Patient; | ||
import seedu.address.model.patient.exceptions.PersonIsNotPatient; | ||
|
@@ -43,13 +43,13 @@ public class EditCommand extends Command { | |
+ "Existing values will be overwritten by the input values.\n" | ||
+ "Parameters: INDEX (must be a positive integer) " | ||
+ "[" + PREFIX_NAME + "NAME] " | ||
+ "[" + PREFIX_NRIC + "NRIC] " | ||
+ "[" + PREFIX_YEAR + "DOB] " | ||
+ "[" + PREFIX_PHONE + "PHONE] " | ||
+ "[" + PREFIX_EMAIL + "EMAIL] " | ||
+ "[" + PREFIX_ADDRESS + "ADDRESS] " | ||
+ "[" + PREFIX_TAG + "TAG]...\n" | ||
+ "[" + PREFIX_ADDRESS + "ADDRESS] \n" | ||
+ "Example: " + COMMAND_WORD + " 1 " | ||
+ PREFIX_PHONE + "91234567 " | ||
+ PREFIX_EMAIL + "[email protected]"; | ||
+ PREFIX_PHONE + "91234567 "; | ||
|
||
public static final String MESSAGE_EDIT_PERSON_SUCCESS = "Edited Person: %1$s"; | ||
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided."; | ||
|
@@ -112,9 +112,8 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript | |
Phone updatedPhone = editPersonDescriptor.getPhone().orElse(personToEdit.getPhone()); | ||
Email updatedEmail = editPersonDescriptor.getEmail().orElse(personToEdit.getEmail()); | ||
Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress()); | ||
Set<Tag> updatedTags = editPersonDescriptor.getTags().orElse(personToEdit.getTags()); | ||
|
||
return new Patient(updatedName, updatedPhone, updatedEmail, updatedAddress, updatedTags, updatedNric, | ||
return new Patient(updatedName, updatedPhone, updatedEmail, updatedAddress, null, updatedNric, | ||
updatedDob); | ||
} else { | ||
throw new PersonIsNotPatient(); | ||
|
@@ -172,7 +171,7 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { | |
* Returns true if at least one field is edited. | ||
*/ | ||
public boolean isAnyFieldEdited() { | ||
return CollectionUtil.isAnyNonNull(name, phone, email, address, tags); | ||
return CollectionUtil.isAnyNonNull(name, nric, dateOfBirth, phone, email, address, tags); | ||
} | ||
|
||
public void setName(Name name) { | ||
|
@@ -231,15 +230,6 @@ public void setTags(Set<Tag> tags) { | |
this.tags = (tags != null) ? new HashSet<>(tags) : null; | ||
} | ||
|
||
/** | ||
* Returns an unmodifiable tag set, which throws {@code UnsupportedOperationException} | ||
* if modification is attempted. | ||
* Returns {@code Optional#empty()} if {@code tags} is null. | ||
*/ | ||
public Optional<Set<Tag>> getTags() { | ||
return (tags != null) ? Optional.of(Collections.unmodifiableSet(tags)) : Optional.empty(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
// short circuit if same object | ||
|
@@ -258,8 +248,7 @@ public boolean equals(Object other) { | |
return getName().equals(e.getName()) | ||
&& getPhone().equals(e.getPhone()) | ||
&& getEmail().equals(e.getEmail()) | ||
&& getAddress().equals(e.getAddress()) | ||
&& getTags().equals(e.getTags()); | ||
&& getAddress().equals(e.getAddress()); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.