forked from AY2425S1-CS2103T-T08-2/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 branch 'master' into add-pianopiece-command
- Loading branch information
Showing
32 changed files
with
373 additions
and
112 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 |
---|---|---|
|
@@ -23,3 +23,4 @@ src/test/data/sandbox/ | |
docs/_site/ | ||
docs/_markbind/logs/ | ||
/bin/ | ||
/.vscode/ |
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 |
---|---|---|
|
@@ -79,16 +79,16 @@ Format: `help` | |
|
||
Adds a person to the address book. | ||
|
||
Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS [t/TAG]…` | ||
Format: `add n/NAME p/PHONE_NUMBER e/EMAIL a/ADDRESS g/GRADE_LEVEL [t/TAG]…` | ||
|
||
<box type="tip" seamless> | ||
|
||
**Tip:** A person can have any number of tags (including 0) | ||
</box> | ||
|
||
Examples: | ||
* `add n/John Doe p/98765432 e/[email protected] a/John street, block 123, #01-01` | ||
* `add n/Betsy Crowe t/friend e/[email protected] a/Newgate Prison p/1234567 t/criminal` | ||
* `add n/John Doe p/98765432 e/[email protected] a/John street, block 123, #01-01 g/LCM 1` | ||
* `add n/Betsy Crowe t/friend e/[email protected] a/Newgate Prison p/1234567 t/criminal g/ABRSM 1` | ||
|
||
### Listing all persons : `list` | ||
|
||
|
@@ -100,7 +100,7 @@ Format: `list` | |
|
||
Edits an existing person in the address book. | ||
|
||
Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [t/TAG]…` | ||
Format: `edit INDEX [n/NAME] [p/PHONE] [e/EMAIL] [a/ADDRESS] [g/GRADE_LEVEL] [t/TAG]…` | ||
|
||
* Edits the person at the specified `INDEX`. The index refers to the index number shown in the displayed person list. The index **must be a positive integer** 1, 2, 3, … | ||
* At least one of the optional fields must be provided. | ||
|
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import static java.util.Objects.requireNonNull; | ||
import static keycontacts.logic.parser.CliSyntax.PREFIX_ADDRESS; | ||
import static keycontacts.logic.parser.CliSyntax.PREFIX_EMAIL; | ||
import static keycontacts.logic.parser.CliSyntax.PREFIX_GRADE_LEVEL; | ||
import static keycontacts.logic.parser.CliSyntax.PREFIX_NAME; | ||
import static keycontacts.logic.parser.CliSyntax.PREFIX_PHONE; | ||
import static keycontacts.logic.parser.CliSyntax.PREFIX_TAG; | ||
|
@@ -32,6 +33,7 @@ public class AddCommand extends Command { | |
+ PREFIX_PHONE + "98765432 " | ||
+ PREFIX_EMAIL + "[email protected] " | ||
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 " | ||
+ PREFIX_GRADE_LEVEL + "RSL 2 " | ||
+ PREFIX_TAG + "friends " | ||
+ PREFIX_TAG + "owesMoney"; | ||
|
||
|
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
import static java.util.Objects.requireNonNull; | ||
import static keycontacts.logic.parser.CliSyntax.PREFIX_ADDRESS; | ||
import static keycontacts.logic.parser.CliSyntax.PREFIX_EMAIL; | ||
import static keycontacts.logic.parser.CliSyntax.PREFIX_GRADE_LEVEL; | ||
import static keycontacts.logic.parser.CliSyntax.PREFIX_NAME; | ||
import static keycontacts.logic.parser.CliSyntax.PREFIX_PHONE; | ||
import static keycontacts.logic.parser.CliSyntax.PREFIX_TAG; | ||
|
@@ -23,6 +24,7 @@ | |
import keycontacts.model.Model; | ||
import keycontacts.model.student.Address; | ||
import keycontacts.model.student.Email; | ||
import keycontacts.model.student.GradeLevel; | ||
import keycontacts.model.student.Name; | ||
import keycontacts.model.student.Phone; | ||
import keycontacts.model.student.Student; | ||
|
@@ -43,7 +45,8 @@ public class EditCommand extends Command { | |
+ "[" + PREFIX_PHONE + "PHONE] " | ||
+ "[" + PREFIX_EMAIL + "EMAIL] " | ||
+ "[" + PREFIX_ADDRESS + "ADDRESS] " | ||
+ "[" + PREFIX_TAG + "TAG]...\n" | ||
+ "[" + PREFIX_TAG + "TAG]..." | ||
+ "[" + PREFIX_GRADE_LEVEL + "GRADE_LEVEL]\n" | ||
+ "Example: " + COMMAND_WORD + " 1 " | ||
+ PREFIX_PHONE + "91234567 " | ||
+ PREFIX_EMAIL + "[email protected]"; | ||
|
@@ -88,7 +91,6 @@ public CommandResult execute(Model model) throws CommandException { | |
return new CommandResult(String.format(MESSAGE_EDIT_STUDENT_SUCCESS, Messages.format(editedStudent))); | ||
} | ||
|
||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (other == this) { | ||
|
@@ -123,6 +125,7 @@ public static class EditStudentDescriptor { | |
private Email email; | ||
private Address address; | ||
private Set<Tag> tags; | ||
private GradeLevel gradeLevel; | ||
|
||
public EditStudentDescriptor() {} | ||
|
||
|
@@ -136,13 +139,14 @@ public EditStudentDescriptor(EditStudentDescriptor toCopy) { | |
setEmail(toCopy.email); | ||
setAddress(toCopy.address); | ||
setTags(toCopy.tags); | ||
setGradeLevel(toCopy.gradeLevel); | ||
} | ||
|
||
/** | ||
* Returns true if at least one field is edited. | ||
*/ | ||
public boolean isAnyFieldEdited() { | ||
return CollectionUtil.isAnyNonNull(name, phone, email, address, tags); | ||
return CollectionUtil.isAnyNonNull(name, phone, email, address, tags, gradeLevel); | ||
} | ||
|
||
public void setName(Name name) { | ||
|
@@ -177,6 +181,14 @@ public Optional<Address> getAddress() { | |
return Optional.ofNullable(address); | ||
} | ||
|
||
public void setGradeLevel(GradeLevel gradeLevel) { | ||
this.gradeLevel = gradeLevel; | ||
} | ||
|
||
public Optional<GradeLevel> getGradeLevel() { | ||
return Optional.ofNullable(gradeLevel); | ||
} | ||
|
||
/** | ||
* Sets {@code tags} to this object's {@code tags}. | ||
* A defensive copy of {@code tags} is used internally. | ||
|
@@ -205,12 +217,13 @@ public boolean equals(Object other) { | |
return false; | ||
} | ||
|
||
EditStudentDescriptor otherEditStudentDescriptor = (EditStudentDescriptor) other; | ||
return Objects.equals(name, otherEditStudentDescriptor.name) | ||
&& Objects.equals(phone, otherEditStudentDescriptor.phone) | ||
&& Objects.equals(email, otherEditStudentDescriptor.email) | ||
&& Objects.equals(address, otherEditStudentDescriptor.address) | ||
&& Objects.equals(tags, otherEditStudentDescriptor.tags); | ||
EditStudentDescriptor otherEditPersonDescriptor = (EditStudentDescriptor) other; | ||
return Objects.equals(name, otherEditPersonDescriptor.name) | ||
&& Objects.equals(phone, otherEditPersonDescriptor.phone) | ||
&& Objects.equals(email, otherEditPersonDescriptor.email) | ||
&& Objects.equals(address, otherEditPersonDescriptor.address) | ||
&& Objects.equals(tags, otherEditPersonDescriptor.tags) | ||
&& Objects.equals(gradeLevel, otherEditPersonDescriptor.gradeLevel); | ||
} | ||
|
||
@Override | ||
|
@@ -221,6 +234,7 @@ public String toString() { | |
.add("email", email) | ||
.add("address", address) | ||
.add("tags", tags) | ||
.add("gradeLevel", gradeLevel) | ||
.toString(); | ||
} | ||
} | ||
|
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.