diff --git a/docs/images/add-remark/$Remark.png b/docs/images/add-remark/$Remark.png deleted file mode 100644 index 959c63440..000000000 Binary files a/docs/images/add-remark/$Remark.png and /dev/null differ diff --git a/docs/images/add-remark/ContextMenu.png b/docs/images/add-remark/ContextMenu.png deleted file mode 100644 index 77536724e..000000000 Binary files a/docs/images/add-remark/ContextMenu.png and /dev/null differ diff --git a/docs/images/add-remark/CreateTest.png b/docs/images/add-remark/CreateTest.png deleted file mode 100644 index 6b7d6dcaf..000000000 Binary files a/docs/images/add-remark/CreateTest.png and /dev/null differ diff --git a/docs/images/add-remark/GradleRun.png b/docs/images/add-remark/GradleRun.png deleted file mode 100644 index 281cc45f0..000000000 Binary files a/docs/images/add-remark/GradleRun.png and /dev/null differ diff --git a/docs/images/add-remark/RemarkBound.png b/docs/images/add-remark/RemarkBound.png deleted file mode 100644 index d335382b2..000000000 Binary files a/docs/images/add-remark/RemarkBound.png and /dev/null differ diff --git a/docs/images/add-remark/RemarkCommandClass.png b/docs/images/add-remark/RemarkCommandClass.png deleted file mode 100644 index 5687a3e95..000000000 Binary files a/docs/images/add-remark/RemarkCommandClass.png and /dev/null differ diff --git a/docs/images/add-remark/RemarkCommandParserClass.png b/docs/images/add-remark/RemarkCommandParserClass.png deleted file mode 100644 index d5ad9c8a0..000000000 Binary files a/docs/images/add-remark/RemarkCommandParserClass.png and /dev/null differ diff --git a/docs/images/add-remark/RemarkComplete.png b/docs/images/add-remark/RemarkComplete.png deleted file mode 100644 index 124ced2c7..000000000 Binary files a/docs/images/add-remark/RemarkComplete.png and /dev/null differ diff --git a/docs/images/add-remark/RemarkFailureOutput.png b/docs/images/add-remark/RemarkFailureOutput.png deleted file mode 100644 index 351257ea3..000000000 Binary files a/docs/images/add-remark/RemarkFailureOutput.png and /dev/null differ diff --git a/docs/images/add-remark/RemarkHello.png b/docs/images/add-remark/RemarkHello.png deleted file mode 100644 index aad48d02f..000000000 Binary files a/docs/images/add-remark/RemarkHello.png and /dev/null differ diff --git a/docs/images/add-remark/RemarkNotImplemented.png b/docs/images/add-remark/RemarkNotImplemented.png deleted file mode 100644 index 1d187f394..000000000 Binary files a/docs/images/add-remark/RemarkNotImplemented.png and /dev/null differ diff --git a/docs/images/remove/$address.png b/docs/images/remove/$address.png deleted file mode 100644 index cf0434e0e..000000000 Binary files a/docs/images/remove/$address.png and /dev/null differ diff --git a/docs/images/remove/SafeDeleteConflicts.png b/docs/images/remove/SafeDeleteConflicts.png deleted file mode 100644 index 8f0abeffd..000000000 Binary files a/docs/images/remove/SafeDeleteConflicts.png and /dev/null differ diff --git a/docs/images/remove/UnsafeDelete.png b/docs/images/remove/UnsafeDelete.png deleted file mode 100644 index 9e376d02a..000000000 Binary files a/docs/images/remove/UnsafeDelete.png and /dev/null differ diff --git a/docs/images/remove/UnsafeDeleteOnField.png b/docs/images/remove/UnsafeDeleteOnField.png deleted file mode 100644 index 44d5bb0a4..000000000 Binary files a/docs/images/remove/UnsafeDeleteOnField.png and /dev/null differ diff --git a/docs/images/tracing/DebuggerStep1.png b/docs/images/tracing/DebuggerStep1.png deleted file mode 100644 index 6d088ae63..000000000 Binary files a/docs/images/tracing/DebuggerStep1.png and /dev/null differ diff --git a/docs/images/tracing/EditCommand.png b/docs/images/tracing/EditCommand.png deleted file mode 100644 index ed34ad08b..000000000 Binary files a/docs/images/tracing/EditCommand.png and /dev/null differ diff --git a/docs/images/tracing/FindUsages.png b/docs/images/tracing/FindUsages.png deleted file mode 100644 index e074d0e86..000000000 Binary files a/docs/images/tracing/FindUsages.png and /dev/null differ diff --git a/docs/images/tracing/LeftGutter.png b/docs/images/tracing/LeftGutter.png deleted file mode 100644 index 571acf99e..000000000 Binary files a/docs/images/tracing/LeftGutter.png and /dev/null differ diff --git a/docs/images/tracing/LogicSequenceDiagram.png b/docs/images/tracing/LogicSequenceDiagram.png deleted file mode 100644 index 25c8b66b9..000000000 Binary files a/docs/images/tracing/LogicSequenceDiagram.png and /dev/null differ diff --git a/docs/images/tracing/ShowExecutionPoint.png b/docs/images/tracing/ShowExecutionPoint.png deleted file mode 100644 index ea72176fa..000000000 Binary files a/docs/images/tracing/ShowExecutionPoint.png and /dev/null differ diff --git a/docs/images/tracing/StepInto.png b/docs/images/tracing/StepInto.png deleted file mode 100644 index ddfa0e2ae..000000000 Binary files a/docs/images/tracing/StepInto.png and /dev/null differ diff --git a/docs/images/tracing/StepOver.png b/docs/images/tracing/StepOver.png deleted file mode 100644 index ed5fb276e..000000000 Binary files a/docs/images/tracing/StepOver.png and /dev/null differ diff --git a/docs/images/tracing/StructureToolWindow.png b/docs/images/tracing/StructureToolWindow.png deleted file mode 100644 index c377c331d..000000000 Binary files a/docs/images/tracing/StructureToolWindow.png and /dev/null differ diff --git a/docs/images/tracing/Variables.png b/docs/images/tracing/Variables.png deleted file mode 100644 index 02ea7b155..000000000 Binary files a/docs/images/tracing/Variables.png and /dev/null differ diff --git a/docs/images/tracing/searchResultsForExecuteMethod.png b/docs/images/tracing/searchResultsForExecuteMethod.png deleted file mode 100644 index 845a0c946..000000000 Binary files a/docs/images/tracing/searchResultsForExecuteMethod.png and /dev/null differ diff --git a/docs/tutorials/AddRemark.md b/docs/tutorials/AddRemark.md deleted file mode 100644 index d98f38982..000000000 --- a/docs/tutorials/AddRemark.md +++ /dev/null @@ -1,399 +0,0 @@ ---- -layout: page -title: "Tutorial: Adding a command" ---- - -Let's walk you through the implementation of a new command — `remark`. - -This command allows users of the AddressBook application to add optional remarks to people in their address book and edit it if required. The command should have the following format: - -`remark INDEX r/REMARK` (e.g., `remark 2 r/Likes baseball`) - -We’ll assume that you have already set up the development environment as outlined in the Developer’s Guide. - - -## Create a new `remark` command - -Looking in the `logic.command` package, you will notice that each existing command have their own class. All the commands inherit from the abstract class `Command` which means that they must override `execute()`. Each `Command` returns an instance of `CommandResult` upon success and `CommandResult#feedbackToUser` is printed to the `ResultDisplay`. - -Let’s start by creating a new `RemarkCommand` class in the `src/main/java/seedu/address/logic/command` directory. - -For now, let’s keep `RemarkCommand` as simple as possible and print some output. We accomplish that by returning a `CommandResult` with an accompanying message. - -**`RemarkCommand.java`:** - -``` java -package seedu.address.logic.commands; - -import seedu.address.model.Model; - -/** - * Changes the remark of an existing person in the address book. - */ -public class RemarkCommand extends Command { - - public static final String COMMAND_WORD = "remark"; - - @Override - public CommandResult execute(Model model) { - return new CommandResult("Hello from remark"); - } -} -``` - -### Hook `RemarkCommand` into the application - -Now that we have our `RemarkCommand` ready to be executed, we need to update `AddressBookParser#parseCommand()` to recognize the `remark` keyword. Add the new command to the `switch` block by creating a new `case` that returns a new instance of `RemarkCommand`. - -You can refer to the changes in this [diff](https://github.com/se-edu/addressbook-level3/commit/35eb7286f18a029d39cb7a29df8f172a001e4fd8#diff-399c284cb892c20b7c04a69116fcff6ccc0666c5230a1db8e4a9145def8fa4ee). - -### Run the application - -Run `Main#main` and try out your new `RemarkCommand`. If everything went well, you should see something like this: - -![Output displayed](../images/add-remark/RemarkHello.png) - -## Change `RemarkCommand` to throw an exception - -While we have successfully printed a message to `ResultDisplay`, the command does not do what it is supposed to do. Let’s change the command to throw a `CommandException` to accurately reflect that our command is still a work in progress. - -![The relationship between RemarkCommand and Command](../images/add-remark/RemarkCommandClass.png) - -Following the convention in other commands, we add relevant messages as constants and use them. - -**`RemarkCommand.java`:** - -``` java - public static final String MESSAGE_USAGE = COMMAND_WORD - + ": Edits the remark of the person identified " - + "by the index number used in the last person listing. " - + "Existing remark will be overwritten by the input.\n" - + "Parameters: INDEX (must be a positive integer) " - + "r/ [REMARK]\n" - + "Example: " + COMMAND_WORD + " 1 " - + "r/ Likes to swim."; - - public static final String MESSAGE_NOT_IMPLEMENTED_YET = - "Remark command not implemented yet"; - - @Override - public CommandResult execute(Model model) throws CommandException { - throw new CommandException(MESSAGE_NOT_IMPLEMENTED_YET); - } -``` - -## Enhancing `RemarkCommand` - -Let’s change `RemarkCommand` to parse input from the user. - -### Make the command accept parameters - -We start by modifying the constructor of `RemarkCommand` to accept an `Index` and a `String`. While we are at it, let’s change the error message to echo the values. While this is not a replacement for tests, it is an obvious way to tell if our code is functioning as intended. - -``` java -import static seedu.address.commons.util.CollectionUtil.requireAllNonNull; -//... -public class RemarkCommand extends Command { - //... - public static final String MESSAGE_ARGUMENTS = "Index: %1$d, Remark: %2$s"; - - private final Index index; - private final String remark; - - /** - * @param index of the person in the filtered person list to edit the remark - * @param remark of the person to be updated to - */ - public RemarkCommand(Index index, String remark) { - requireAllNonNull(index, remark); - - this.index = index; - this.remark = remark; - } - @Override - public CommandResult execute(Model model) throws CommandException { - throw new CommandException( - String.format(MESSAGE_ARGUMENTS, index.getOneBased(), remark)); - } - - @Override - public boolean equals(Object other) { - if (other == this) { - return true; - } - - // instanceof handles nulls - if (!(other instanceof RemarkCommand)) { - return false; - } - - RemarkCommand e = (RemarkCommand) other; - return index.equals(e.index) - && remark.equals(e.remark); - } -} -``` - -Your code should look something like [this](https://github.com/se-edu/addressbook-level3/commit/dc6d5139d08f6403da0ec624ea32bd79a2ae0cbf#diff-a8e35af8f9c251525063fae36c9852922a7e7195763018eacec60f3a4d87c594) after you are done. - -### Parse user input - -Now let’s move on to writing a parser that will extract the index and remark from the input provided by the user. - -Create a `RemarkCommandParser` class in the `seedu.address.logic.parser` package. The class must extend the `Parser` interface. - -![The relationship between Parser and RemarkCommandParser](../images/add-remark/RemarkCommandParserClass.png) - -Thankfully, `ArgumentTokenizer#tokenize()` makes it trivial to parse user input. Let’s take a look at the JavaDoc provided for the function to understand what it does. - -**`ArgumentTokenizer.java`:** - -``` java -/** - * Tokenizes an arguments string and returns an {@code ArgumentMultimap} - * object that maps prefixes to their respective argument values. Only the - * given prefixes will be recognized in the arguments string. - * - * @param argsString Arguments string of the form: - * {@code preamble value value ...} - * @param prefixes Prefixes to tokenize the arguments string with - * @return ArgumentMultimap object that maps prefixes to their - * arguments - */ -``` - -We can tell `ArgumentTokenizer#tokenize()` to look out for our new prefix `r/` and it will return us an instance of `ArgumentMultimap`. Now let’s find out what we need to do in order to obtain the Index and String that we need. Let’s look through `ArgumentMultimap` : - -**`ArgumentMultimap.java`:** - -``` java -/** - * Returns the last value of {@code prefix}. - */ -public Optional getValue(Prefix prefix) { - List values = getAllValues(prefix); - return values.isEmpty() ? Optional.empty() : - Optional.of(values.get(values.size() - 1)); -} -``` - -This appears to be what we need to get a String of the remark. But what about the Index? Let's take a quick peek at existing `Command` that uses an index to see how it is done. - -**`DeleteCommandParser.java`:** - -``` java -Index index = ParserUtil.parseIndex(args); -return new DeleteCommand(index); -``` - -There appears to be another utility class that obtains an `Index` from the input provided by the user. - -Now that we have the know-how to extract the data that we need from the user’s input, we can parse the user command and create a new instance of `RemarkCommand`, as given below. - -**`RemarkCommandParser.java`:** - -``` java -public RemarkCommand parse(String args) throws ParseException { - requireNonNull(args); - ArgumentMultimap argMultimap = ArgumentTokenizer.tokenize(args, - PREFIX_REMARK); - - Index index; - try { - index = ParserUtil.parseIndex(argMultimap.getPreamble()); - } catch (IllegalValueException ive) { - throw new ParseException(String.format(MESSAGE_INVALID_COMMAND_FORMAT, - RemarkCommand.MESSAGE_USAGE), ive); - } - - String remark = argMultimap.getValue(PREFIX_REMARK).orElse(""); - - return new RemarkCommand(index, remark); -} -``` - -
- -:information_source: Don’t forget to update `AddressBookParser` to use our new `RemarkCommandParser`! - -
- -If you are stuck, check out the sample -[here](https://github.com/se-edu/addressbook-level3/commit/dc6d5139d08f6403da0ec624ea32bd79a2ae0cbf#diff-8bf239e8e9529369b577701303ddd96af93178b4ed6735f91c2d8488b20c6b4a). - -## Add `Remark` to the model - -Now that we have all the information that we need, let’s lay the groundwork for propagating the remarks added into the in-memory storage of person data. We achieve that by working with the `Person` model. Each field in a Person is implemented as a separate class (e.g. a `Name` object represents the person’s name). That means we should add a `Remark` class so that we can use a `Remark` object to represent a remark given to a person. - -### Add a new `Remark` class - -Create a new `Remark` in `seedu.address.model.person`. Since a `Remark` is a field that is similar to `Address`, we can reuse a significant bit of code. - -A copy-paste and search-replace later, you should have something like [this](https://github.com/se-edu/addressbook-level3/commit/4516e099699baa9e2d51801bd26f016d812dedcc#diff-41bb13c581e280c686198251ad6cc337cd5e27032772f06ed9bf7f1440995ece). Note how `Remark` has no constrains and thus does not require input -validation. - -### Make use of `Remark` - -Let’s change `RemarkCommand` and `RemarkCommandParser` to use the new `Remark` class instead of plain `String`. These should be relatively simple changes. - -## Add a placeholder element for remark to the UI - -Without getting too deep into `fxml`, let’s go on a 5 minute adventure to get some placeholder text to show up for each person. - -Simply add the following to [`seedu.address.ui.PersonCard`](https://github.com/se-edu/addressbook-level3/commit/850b78879582f38accb05dd20c245963c65ea599#diff-639834f1e05afe2276a86372adf0fe5f69314642c2d93cfa543d614ce5a76688). - -**`PersonCard.java`:** - -``` java -@FXML -private Label remark; -``` - - -`@FXML` is an annotation that marks a private or protected field and makes it accessible to FXML. It might sound like Greek to you right now, don’t worry — we will get back to it later. - -Then insert the following into [`main/resources/view/PersonListCard.fxml`](https://github.com/se-edu/addressbook-level3/commit/850b78879582f38accb05dd20c245963c65ea599#diff-d44c4f51c24f6253c277a2bb9bc440b8064d9c15ad7cb7ceda280bca032efce9). - -**`PersonListCard.fxml`:** - -``` xml -