forked from AY2425S1-CS2103T-F15-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 pull request AY2425S1-CS2103T-F15-2#154 from JYL27/branch-Refac…
…torTag Change Tag class to Role
- Loading branch information
Showing
53 changed files
with
466 additions
and
465 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -143,7 +143,7 @@ Adds a person contact to the EduContacts. | |
|
||
Format: | ||
```bash | ||
add ID n/NAME p/PHONE e/EMAIL a/ADDRESS c/COURSE t/TAG | ||
add ID n/NAME p/PHONE e/EMAIL a/ADDRESS c/COURSE r/ROLE | ||
``` | ||
|
||
Examples: | ||
|
@@ -385,10 +385,10 @@ _Details coming soon ..._ | |
|
||
Action | Format, Examples | ||
-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ||
**Add** | `add ID n/NAME p/PHONE e/EMAIL a/ADDRESS c/COURSE t/TAG` <br> e.g., `add 12345678 n/John Doe p/99999999 e/[email protected] a/123 Jane Doe Road c/Computer Science t/Student` | ||
**Add** | `add ID n/NAME p/PHONE e/EMAIL a/ADDRESS c/COURSE r/ROLE` <br> e.g., `add 12345678 n/John Doe p/99999999 e/[email protected] a/123 Jane Doe Road c/Computer Science t/Student` | ||
**Clear** | `clear` | ||
**Delete** | `delete ID`<br> e.g., `delete 12345678` | ||
**Edit** | `edit ID [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [c/COURSE] [t/TAG]…`<br> e.g.,`edit 12345678 p/91234567 e/[email protected]` | ||
**Edit** | `edit ID [n/NAME] [p/PHONE_NUMBER] [e/EMAIL] [a/ADDRESS] [c/COURSE] [r/ROLE]…`<br> e.g.,`edit 12345678 p/91234567 e/[email protected]` | ||
**Grade** | `grade ID m/MODULE g/GRADE` <br> e.g. `grade 12345678 m/CS2103T g/A` | ||
**Add Module** | `module ID [m/MODULE]` <br> e.g., `add 12345678 m/CS2103T` | ||
**Filter** | `filter [n/NAME] [c/COURSE] [m/MODULE]`<br> e.g., `filter n/James Jake` | ||
|
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
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_PHONE; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_ROLE; | ||
|
||
import seedu.address.commons.util.ToStringBuilder; | ||
import seedu.address.logic.Messages; | ||
|
@@ -29,15 +29,15 @@ public class AddCommand extends Command { | |
+ PREFIX_EMAIL + "EMAIL " | ||
+ PREFIX_ADDRESS + "ADDRESS " | ||
+ PREFIX_COURSE + "COURSE " | ||
+ PREFIX_TAG + "TAG\n" | ||
+ PREFIX_ROLE + "ROLE\n" | ||
+ "Example: " + COMMAND_WORD + " " | ||
+ "12345678 " | ||
+ PREFIX_NAME + "John Doe " | ||
+ PREFIX_PHONE + "98765432 " | ||
+ PREFIX_EMAIL + "[email protected] " | ||
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 " | ||
+ PREFIX_COURSE + "Computer Science " | ||
+ PREFIX_TAG + "Student "; | ||
+ PREFIX_ROLE + "Student "; | ||
|
||
|
||
public static final String MESSAGE_SUCCESS = "New person added: %1$s"; | ||
|
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 |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
import static seedu.address.logic.parser.CliSyntax.PREFIX_MODULE; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME; | ||
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_ROLE; | ||
import static seedu.address.model.Model.PREDICATE_SHOW_ALL_PERSONS; | ||
|
||
import java.util.ArrayList; | ||
|
@@ -27,8 +27,8 @@ | |
import seedu.address.model.person.Name; | ||
import seedu.address.model.person.Person; | ||
import seedu.address.model.person.Phone; | ||
import seedu.address.model.person.Role; | ||
import seedu.address.model.person.StudentId; | ||
import seedu.address.model.person.Tag; | ||
|
||
/** | ||
* Edits the details of an existing person in EduContacts. | ||
|
@@ -48,7 +48,7 @@ public class EditCommand extends Command { | |
+ "[" + PREFIX_EMAIL + "EMAIL] " | ||
+ "[" + PREFIX_ADDRESS + "ADDRESS] " | ||
+ "[" + PREFIX_COURSE + " COURSE] " | ||
+ "[" + PREFIX_TAG + "TAG] ...\n" | ||
+ "[" + PREFIX_ROLE + "ROLE] ...\n" | ||
+ "Example: " + COMMAND_WORD + " 12345678 " | ||
+ PREFIX_PHONE + "91234567 " | ||
+ PREFIX_EMAIL + "[email protected]" | ||
|
@@ -116,7 +116,7 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript | |
Email updatedEmail = editPersonDescriptor.getEmail().orElse(personToEdit.getEmail()); | ||
Address updatedAddress = editPersonDescriptor.getAddress().orElse(personToEdit.getAddress()); | ||
Course updatedCourse = editPersonDescriptor.getCourse().orElse(personToEdit.getCourse()); | ||
Tag updatedTag = editPersonDescriptor.getTag().orElse(personToEdit.getTag()); | ||
Role updatedRole = editPersonDescriptor.getRole().orElse(personToEdit.getRole()); | ||
|
||
ArrayList<Module> updatedModules = editPersonDescriptor.getModules().orElse(personToEdit.getModules()); | ||
if (editPersonDescriptor.hasModuleChanges()) { | ||
|
@@ -146,7 +146,7 @@ private static Person createEditedPerson(Person personToEdit, EditPersonDescript | |
} | ||
|
||
Person editedPerson = new Person(personToEdit.getStudentId(), updatedName, updatedPhone, updatedEmail, | ||
updatedAddress, updatedCourse, updatedTag, updatedModules); | ||
updatedAddress, updatedCourse, updatedRole, updatedModules); | ||
|
||
return editedPerson; | ||
} | ||
|
@@ -186,7 +186,7 @@ public static class EditPersonDescriptor { | |
private Email email; | ||
private Address address; | ||
private Course course; | ||
private Tag tag; | ||
private Role role; | ||
private ArrayList<Module> modules; | ||
private Module oldModule; | ||
private Module newModule; | ||
|
@@ -195,7 +195,7 @@ public EditPersonDescriptor() {} | |
|
||
/** | ||
* Copy constructor. | ||
* A defensive copy of {@code tags} is used internally. | ||
* A defensive copy of {@code roles} is used internally. | ||
*/ | ||
public EditPersonDescriptor(EditPersonDescriptor toCopy) { | ||
setStudentId(null); | ||
|
@@ -204,7 +204,7 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { | |
setEmail(toCopy.email); | ||
setAddress(toCopy.address); | ||
setCourse(toCopy.course); | ||
setTag(toCopy.tag); | ||
setRole(toCopy.role); | ||
setModules(toCopy.modules); | ||
setOldModule(toCopy.oldModule); | ||
setNewModule(toCopy.newModule); | ||
|
@@ -214,7 +214,7 @@ public EditPersonDescriptor(EditPersonDescriptor toCopy) { | |
* Returns true if at least one field is edited. | ||
*/ | ||
public boolean isAnyFieldEdited() { | ||
return CollectionUtil.isAnyNonNull(studentId, name, phone, email, address, course, tag, modules) | ||
return CollectionUtil.isAnyNonNull(studentId, name, phone, email, address, course, role, modules) | ||
|| hasModuleChanges(); | ||
} | ||
|
||
|
@@ -283,20 +283,20 @@ public Optional<Module> getOldModule() { | |
} | ||
|
||
/** | ||
* Sets {@code tags} to this object's {@code tags}. | ||
* A defensive copy of {@code tags} is used internally. | ||
* Sets {@code roles} to this object's {@code roles}. | ||
* A defensive copy of {@code roles} is used internally. | ||
*/ | ||
public void setTag(Tag tag) { | ||
this.tag = tag; | ||
public void setRole(Role role) { | ||
this.role = role; | ||
} | ||
|
||
/** | ||
* Returns an unmodifiable tag set, which throws {@code UnsupportedOperationException} | ||
* Returns an unmodifiable role set, which throws {@code UnsupportedOperationException} | ||
* if modification is attempted. | ||
* Returns {@code Optional#empty()} if {@code tags} is null. | ||
* Returns {@code Optional#empty()} if {@code roles} is null. | ||
*/ | ||
public Optional<Tag> getTag() { | ||
return Optional.ofNullable(tag); | ||
public Optional<Role> getRole() { | ||
return Optional.ofNullable(role); | ||
} | ||
|
||
public void setModules(ArrayList<Module> modules) { | ||
|
@@ -327,7 +327,7 @@ public boolean equals(Object other) { | |
&& Objects.equals(email, otherEditPersonDescriptor.email) | ||
&& Objects.equals(address, otherEditPersonDescriptor.address) | ||
&& Objects.equals(course, otherEditPersonDescriptor.course) | ||
&& Objects.equals(tag, otherEditPersonDescriptor.tag) | ||
&& Objects.equals(role, otherEditPersonDescriptor.role) | ||
&& Objects.equals(modules, otherEditPersonDescriptor.modules) | ||
&& Objects.equals(oldModule, otherEditPersonDescriptor.oldModule) | ||
&& Objects.equals(newModule, otherEditPersonDescriptor.newModule); | ||
|
@@ -351,7 +351,7 @@ public String toString() { | |
.add("email", email) | ||
.add("address", address) | ||
.add("course", course) | ||
.add("tags", tag) | ||
.add("roles", role) | ||
.add("modules", modules) | ||
.add("oldModule", oldModule) | ||
.add("newModule", newModule) | ||
|
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
Oops, something went wrong.