forked from nus-cs2103-AY2324S1/tp
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
95 changed files
with
1,749 additions
and
2,008 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
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -28,7 +28,7 @@ IntelliJ IDEA provides a refactoring tool that can identify *most* parts of a re | |
|
||
### Assisted refactoring | ||
|
||
The `address` field in `Person` is actually an instance of the `seedu.address.model.person.Address` class. Since removing the `Address` class will break the application, we start by identifying `Address`'s usages. This allows us to see code that depends on `Address` to function properly and edit them on a case-by-case basis. Right-click the `Address` class and select `Refactor` \> `Safe Delete` through the menu. | ||
The `address` field in `Person` is actually an instance of the `seedu.address.model.tutor.Address` class. Since removing the `Address` class will break the application, we start by identifying `Address`'s usages. This allows us to see code that depends on `Address` to function properly and edit them on a case-by-case basis. Right-click the `Address` class and select `Refactor` \> `Safe Delete` through the menu. | ||
* :bulb: To make things simpler, you can unselect the options `Search in comments and strings` and `Search for text occurrences` | ||
|
||
![Usages detected](../images/remove/UnsafeDelete.png) | ||
|
@@ -100,7 +100,7 @@ In `src/test/data/`, data meant for testing purposes are stored. While keeping t | |
|
||
```json | ||
{ | ||
"persons": [ { | ||
"tutors": [ { | ||
"name": "Person with invalid name field: Ha!ns Mu@ster", | ||
"phone": "9482424", | ||
"email": "[email protected]", | ||
|
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 |
---|---|---|
@@ -1,7 +1,6 @@ | ||
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_PHONE; | ||
|
@@ -11,52 +10,50 @@ | |
import seedu.address.logic.Messages; | ||
import seedu.address.logic.commands.exceptions.CommandException; | ||
import seedu.address.model.Model; | ||
import seedu.address.model.person.Person; | ||
import seedu.address.model.tutor.Tutor; | ||
|
||
/** | ||
* Adds a person to the address book. | ||
* Adds a tutor to the address book. | ||
*/ | ||
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 tutor to the address book. " | ||
+ "Parameters: " | ||
+ PREFIX_NAME + "NAME " | ||
+ PREFIX_PHONE + "PHONE " | ||
+ PREFIX_EMAIL + "EMAIL " | ||
+ PREFIX_ADDRESS + "ADDRESS " | ||
+ "[" + PREFIX_TAG + "TAG]...\n" | ||
+ "Example: " + COMMAND_WORD + " " | ||
+ 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"; | ||
|
||
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 tutor added: %1$s"; | ||
public static final String MESSAGE_DUPLICATE_TUTOR = "This tutor already exists in the address book"; | ||
|
||
private final Person toAdd; | ||
private final Tutor toAdd; | ||
|
||
/** | ||
* Creates an AddCommand to add the specified {@code Person} | ||
* Creates an AddCommand to add the specified {@code Tutor} | ||
*/ | ||
public AddCommand(Person person) { | ||
requireNonNull(person); | ||
toAdd = person; | ||
public AddCommand(Tutor tutor) { | ||
requireNonNull(tutor); | ||
toAdd = tutor; | ||
} | ||
|
||
@Override | ||
public CommandResult execute(Model model) throws CommandException { | ||
requireNonNull(model); | ||
|
||
if (model.hasPerson(toAdd)) { | ||
throw new CommandException(MESSAGE_DUPLICATE_PERSON); | ||
if (model.hasTutor(toAdd)) { | ||
throw new CommandException(MESSAGE_DUPLICATE_TUTOR); | ||
} | ||
|
||
model.addPerson(toAdd); | ||
model.addTutor(toAdd); | ||
return new CommandResult(String.format(MESSAGE_SUCCESS, Messages.format(toAdd))); | ||
} | ||
|
||
|
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.