Skip to content

Commit

Permalink
Merge branch 'master' into developer-guide-appendix
Browse files Browse the repository at this point in the history
  • Loading branch information
yisiox committed Apr 15, 2024
2 parents a9dfb8d + ca79bd1 commit e7aab24
Show file tree
Hide file tree
Showing 69 changed files with 445 additions and 422 deletions.
6 changes: 1 addition & 5 deletions docs/AboutUs.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

We are a team based in the [School of Computing, National University of Singapore](http://www.comp.nus.edu.sg).

You can reach us at the email `seer[at]comp.nus.edu.sg`

## Project team

### Tang Yetong
Expand Down Expand Up @@ -41,7 +39,7 @@ versioning, maintaining the code, and vets all changes to the code.
[[github](http://github.com/bryanyee33)]
[[portfolio](team/bryanyee33.md)]

* Roles: Backend Expert
* Role: Backend Expert
* Responsibilities: In charge of backend implementation and associated technical
documentation.

Expand All @@ -66,5 +64,3 @@ maintains user documentation.
* Role: Taskmaster & QA Expert
* Responsibilities: In charge of overall coordination, tracking deadlines and
deliverables, testing of code, and ensuring code and documentation quality.


287 changes: 153 additions & 134 deletions docs/UserGuide.md

Large diffs are not rendered by default.

Binary file modified docs/images/example-add-after-fail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/example-add-after.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/example-find.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/images_source.pptx
Binary file not shown.
Binary file modified docs/images/tutorial-add-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/tutorial-asset-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/tutorial-edit-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/tutorial-edit-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/tutorial-edit-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/tutorial-find-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/images/tutorial-find-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 9 additions & 5 deletions src/main/java/seedu/address/MainApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public class MainApp extends Application {

private static final Logger logger = LogsCenter.getLogger(MainApp.class);

private static final String ADDRESS_BOOK_LOAD_SUCCESSFUL =
"Data file loaded successfully.";
private static final String ADDRESS_BOOK_LOAD_UNSUCCESSFUL =
"WARNING!! Entering a command will override the old data file.";

private Ui ui;
private Storage storage;
private Model model;
Expand Down Expand Up @@ -148,18 +153,17 @@ private static UserPrefs initPrefs(UserPrefsStorage storage) {
/**
* Reads the filepath stored within a {@code Storage} object and returns a {@code ReadOnlyAddressBook}.
*
* @param storage the storage object.
* @return a read-only address book.
* @param storage The storage object.
* @return A read-only address book.
*/
private ReadOnlyAddressBook initAddressBook(Storage storage) {
ReadOnlyAddressBook initialAddressBook;
try {
initialAddressBook = storage.readInitialAddressBook();
initialWelcomeMessage = "Data file loaded successfully.";
initialWelcomeMessage = ADDRESS_BOOK_LOAD_SUCCESSFUL;
} catch (DataLoadingException e) {
initialAddressBook = new AddressBook();
initialWelcomeMessage = "WARNING!! Entering a command will override the old data file.\n"
+ e.getMessage();
initialWelcomeMessage = ADDRESS_BOOK_LOAD_UNSUCCESSFUL + "\n" + e.getMessage();
}
return initialAddressBook;
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/seedu/address/commons/core/GuiSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public GuiSettings() {
/**
* Constructs a {@code GuiSettings} with the specified parameters.
*
* @param windowWidth the window's width.
* @param windowHeight the window's height.
* @param xPosition the window's x-coordinate on the screen.
* @param yPosition the window's y-coordinate on the screen.
* @param isMaximized whether the window is maximized.
* @param splitPaneDividerPosition the height of the TextArea resultDisplay.
* @param windowWidth The window's width.
* @param windowHeight The window's height.
* @param xPosition The window's x-coordinate on the screen.
* @param yPosition The window's y-coordinate on the screen.
* @param isMaximized Whether the window is maximized.
* @param splitPaneDividerPosition The height of the TextArea resultDisplay.
*/
public GuiSettings(double windowWidth, double windowHeight, int xPosition, int yPosition,
boolean isMaximized, double splitPaneDividerPosition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ public DataLoadingException(Exception cause) {
super(cause);
}

public DataLoadingException(String message, Throwable cause) {
super(message, cause);
}

}
11 changes: 6 additions & 5 deletions src/main/java/seedu/address/logic/CommandHistory.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import seedu.address.commons.exceptions.CommandHistoryException;

//@@author aureliony
/**
* Represents an abstraction for a command history data structure.
*/
Expand All @@ -19,8 +20,8 @@ public class CommandHistory {
/**
* Get the previous command text.
*
* @return the previous command text.
* @throws CommandHistoryException if the message history is empty or the index is already at the start.
* @return The previous command text.
* @throws CommandHistoryException If the message history is empty or the index is already at the start.
*/
public String getPrevious() throws CommandHistoryException {
assert 0 <= index && index <= commandHistory.size();
Expand All @@ -40,8 +41,8 @@ public String getPrevious() throws CommandHistoryException {
/**
* Get the next command text.
*
* @return the next command text.
* @throws CommandHistoryException if the index is already at the end.
* @return The next command text.
* @throws CommandHistoryException If the index is already at the end.
*/
public String getNext() throws CommandHistoryException {
assert 0 <= index && index <= commandHistory.size();
Expand All @@ -62,7 +63,7 @@ public String getNext() throws CommandHistoryException {
/**
* Add a valid command text to the command history.
*
* @param commandText the command text string.
* @param commandText The command text string.
*/
public void add(String commandText) {
commandHistory.add(commandText);
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/seedu/address/logic/Logic.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import javafx.collections.ObservableList;
import seedu.address.commons.core.GuiSettings;
import seedu.address.commons.exceptions.CommandHistoryException;
import seedu.address.commons.exceptions.DataLoadingException;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.logic.util.exceptions.ParseException;
import seedu.address.model.person.Person;
import seedu.address.storage.exceptions.StorageException;

/**
* API of the Logic component
Expand All @@ -18,25 +18,25 @@ public interface Logic {
/**
* Executes the command and returns the result.
* @param commandText The command as entered by the user.
* @return the result of the command execution.
* @return The result of the command execution.
* @throws CommandException If an error occurs during command execution.
* @throws ParseException If an error occurs during parsing.
*/
String execute(String commandText) throws CommandException, ParseException, StorageException;
String execute(String commandText) throws CommandException, ParseException, DataLoadingException;

/**
* Gets the previous command's text.
*
* @return the previous command's text.
* @throws CommandHistoryException if the message history is empty or the index is already at the start.
* @return The previous command's text.
* @throws CommandHistoryException If the message history is empty or the index is already at the start.
*/
String getPreviousCommandText() throws CommandHistoryException;

/**
* Gets the next command's text.
*
* @return the next command's text.
* @throws CommandHistoryException if the index is already at the end.
* @return The next command's text.
* @throws CommandHistoryException If the index is already at the end.
*/
String getNextCommandText() throws CommandHistoryException;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/LogicManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import seedu.address.commons.core.GuiSettings;
import seedu.address.commons.core.LogsCenter;
import seedu.address.commons.exceptions.CommandHistoryException;
import seedu.address.commons.exceptions.DataLoadingException;
import seedu.address.logic.commands.Command;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.logic.util.AddressBookParser;
import seedu.address.logic.util.exceptions.ParseException;
import seedu.address.model.Model;
import seedu.address.model.person.Person;
import seedu.address.storage.Storage;
import seedu.address.storage.exceptions.StorageException;

/**
* The main LogicManager of the app.
Expand All @@ -37,7 +37,7 @@ public LogicManager(Model model, Storage storage) {
}

@Override
public String execute(String commandText) throws CommandException, ParseException, StorageException {
public String execute(String commandText) throws CommandException, ParseException, DataLoadingException {
logger.info("----------------[USER COMMAND][" + commandText + "]");

Command command = AddressBookParser.parseCommand(commandText);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/seedu/address/logic/Messages.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ public class Messages {

public static final String MESSAGE_UNKNOWN_COMMAND = "Unknown command";
public static final String MESSAGE_INVALID_COMMAND_FORMAT = "Invalid command format! \n%1$s";
public static final String MESSAGE_INVALID_PERSON_DISPLAYED_INDEX = "The person index provided is invalid";
public static final String MESSAGE_PERSONS_LISTED_OVERVIEW = "%1$d persons listed!";
public static final String MESSAGE_INVALID_CONTACT_DISPLAYED_INDEX = "The contact index provided is invalid";
public static final String MESSAGE_CONTACTS_LISTED_OVERVIEW = "%1$d contact(s) listed!";
public static final String MESSAGE_DUPLICATE_FIELDS =
"Multiple values specified for the following single-valued field(s): ";

public static final String MESSAGE_SHOWING_HELP = "Opened help window.";
public static final String MESSAGE_EXITING = "Exiting AssetBook as requested ...";
public static final String MESSAGE_COPIED = "Copied details to clipboard: %1$s";
public static final int MESSAGE_COPIED_LEN = "Copied details to clipboard:".length();
public static final String MESSAGE_COPIED = "Copied detail(s) to clipboard: %1$s";
public static final int MESSAGE_COPIED_LEN = "Copied detail(s) to clipboard:".length();

/**
* Returns an error message indicating the duplicate prefixes.
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/seedu/address/logic/commands/AddCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@
import seedu.address.model.person.fields.Tags;

/**
* Adds a person to the address book.
* Adds a contact to AssetBook.
*/
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 contact to AssetBook. "
+ "Parameters: "
+ PREFIX_NAME + "NAME "
+ PREFIX_PHONE + "PHONE "
Expand All @@ -50,8 +50,8 @@ public class AddCommand extends Command {
+ PREFIX_TAG + "owesMoney "
+ PREFIX_ASSET + "screwdriver";

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 contact added: %1$s";
public static final String MESSAGE_DUPLICATE_CONTACT = "This contact already exists.";

private final Person toAdd;

Expand All @@ -68,7 +68,7 @@ public String execute(Model model) throws CommandException {
requireNonNull(model);

if (model.hasPerson(toAdd)) {
throw new CommandException(MESSAGE_DUPLICATE_PERSON);
throw new CommandException(MESSAGE_DUPLICATE_CONTACT);
}

model.addPerson(toAdd);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/commands/AssetCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public class AssetCommand extends Command {
public static final Prefix PREFIX_OLD = new Prefix("o\\");
public static final Prefix PREFIX_NEW = new Prefix("n\\");

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the asset identified "
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the asset identified. "
+ "Existing values will be overwritten by the input values.\n"
+ "Parameters: " + PREFIX_OLD + "OLDNAME " + PREFIX_NEW + "NEWNAME\n"
+ "OLDNAME must be an existing asset name"
+ "OLDNAME must be an existing asset name.\n"
+ "Example: " + COMMAND_WORD + " " + PREFIX_OLD + "Aircon " + PREFIX_NEW + "Hammer";

public static final String MESSAGE_SUCCESS = "Edited Asset: %1$s";
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/commands/ClearCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@
import seedu.address.model.Model;

/**
* Clears the address book.
* Clears AssetBook.
*/
public class ClearCommand extends Command {

public static final String COMMAND_WORD = "clear";
public static final String MESSAGE_SUCCESS = "Address book has been cleared!";
public static final String MESSAGE_SUCCESS = "AssetBook has been cleared!";

@Override
public String execute(Model model) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/commands/CopyCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import seedu.address.model.person.Person;

/**
* Copies the details of a person in the address book.
* Copies the details of a contact in the address book.
*/
public class CopyCommand extends Command {

Expand Down Expand Up @@ -62,7 +62,7 @@ public String execute(Model model) throws CommandException {
List<Person> lastShownList = model.getFilteredPersonList();

if (index.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
throw new CommandException(Messages.MESSAGE_INVALID_CONTACT_DISPLAYED_INDEX);
}

Person personToCopy = lastShownList.get(index.getZeroBased());
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/seedu/address/logic/commands/DeleteCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
import seedu.address.model.person.Person;

/**
* Deletes a person identified using it's displayed index from the address book.
* Deletes a contact identified using it's displayed index from AssetBook.
*/
public class DeleteCommand extends Command {

public static final String COMMAND_WORD = "delete";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Deletes the person identified by the index number used in the displayed person list.\n"
+ ": Deletes the contact identified by the index number used in the displayed contact list.\n"
+ "Parameters: INDEX (must be a positive integer)\n"
+ "Example: " + COMMAND_WORD + " 1";

public static final String MESSAGE_DELETE_PERSON_SUCCESS = "Deleted Person: %1$s";
public static final String MESSAGE_DELETE_CONTACT_SUCCESS = "Deleted Contact: %1$s";

private final Index targetIndex;

Expand Down Expand Up @@ -55,12 +55,12 @@ public String execute(Model model) throws CommandException {
List<Person> lastShownList = model.getFilteredPersonList();

if (targetIndex.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
throw new CommandException(Messages.MESSAGE_INVALID_CONTACT_DISPLAYED_INDEX);
}

Person personToDelete = lastShownList.get(targetIndex.getZeroBased());
model.deletePerson(personToDelete);
return String.format(MESSAGE_DELETE_PERSON_SUCCESS, Messages.format(personToDelete));
return String.format(MESSAGE_DELETE_CONTACT_SUCCESS, Messages.format(personToDelete));
}

@Override
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/seedu/address/logic/commands/EditCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@
import seedu.address.model.person.fields.Tags;

/**
* Edits the details of an existing person in the address book.
* Edits the details of an existing contact in AssetBook.
*/
public class EditCommand extends Command {

public static final String COMMAND_WORD = "edit";

public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the person identified "
+ "by the index number used in the displayed person list. "
public static final String MESSAGE_USAGE = COMMAND_WORD + ": Edits the details of the contact identified "
+ "by the index number used in the displayed contact list. "
+ "Existing values will be overwritten by the input values.\n"
+ "Parameters: INDEX (must be a positive integer) "
+ "[" + PREFIX_NAME + "NAME] "
Expand All @@ -54,9 +54,9 @@ public class EditCommand extends Command {
+ PREFIX_PHONE + "91234567 "
+ PREFIX_EMAIL + "[email protected]";

public static final String MESSAGE_EDIT_PERSON_SUCCESS = "Edited Person: %1$s";
public static final String MESSAGE_EDIT_CONTACT_SUCCESS = "Edited Contact: %1$s";
public static final String MESSAGE_NOT_EDITED = "At least one field to edit must be provided.";
public static final String MESSAGE_DUPLICATE_PERSON = "This person already exists in the address book.";
public static final String MESSAGE_DUPLICATE_CONTACT = "This contact already exists.";

private final Index index;
private final EditPersonDescriptor editPersonDescriptor;
Expand All @@ -79,19 +79,19 @@ public String execute(Model model) throws CommandException {
List<Person> lastShownList = model.getFilteredPersonList();

if (index.getZeroBased() >= lastShownList.size()) {
throw new CommandException(Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
throw new CommandException(Messages.MESSAGE_INVALID_CONTACT_DISPLAYED_INDEX);
}

Person personToEdit = lastShownList.get(index.getZeroBased());
Person editedPerson = createEditedPerson(personToEdit, editPersonDescriptor);

if (!personToEdit.isSamePerson(editedPerson) && model.hasPerson(editedPerson)) {
throw new CommandException(MESSAGE_DUPLICATE_PERSON);
throw new CommandException(MESSAGE_DUPLICATE_CONTACT);
}

model.setPerson(personToEdit, editedPerson);
model.updateFilteredPersonList(PREDICATE_SHOW_ALL_PERSONS);
return String.format(MESSAGE_EDIT_PERSON_SUCCESS, Messages.format(editedPerson));
return String.format(MESSAGE_EDIT_CONTACT_SUCCESS, Messages.format(editedPerson));
}

/**
Expand Down
Loading

0 comments on commit e7aab24

Please sign in to comment.