Skip to content

Commit

Permalink
Merge pull request #260 from AY2324S2-CS2103T-W12-3/201-206-fix-grammar
Browse files Browse the repository at this point in the history
Fix grammar and incorrect output messages
  • Loading branch information
aureliony authored Apr 12, 2024
2 parents 558851f + 57944f5 commit 5b73e93
Show file tree
Hide file tree
Showing 27 changed files with 55 additions and 55 deletions.
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 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.
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
6 changes: 3 additions & 3 deletions src/main/java/seedu/address/logic/commands/FindCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
import seedu.address.model.person.PersonMatchesQueryPredicate;

/**
* Finds and lists all persons in the address book such that certain fields match the predicate.
* Finds and lists all contacts in the address book such that certain fields match the predicate.
* See {@code PersonMatchesQueryPredicate}.
*/
public class FindCommand extends Command {

public static final String COMMAND_WORD = "find";

public static final String MESSAGE_USAGE = COMMAND_WORD
+ ": Finds all persons whose names, assets or tags contains "
+ ": Finds all contacts whose names, assets or tags contains "
+ "the specified query (case-insensitive) and displays them as a list with index numbers.\n"
+ "All whitespaces are ignored.\n"
+ "Parameters: QUERY\n"
Expand All @@ -35,7 +35,7 @@ public FindCommand(Predicate<Person> predicate) {
public String execute(Model model) {
requireNonNull(model);
model.updateFilteredPersonList(predicate);
return String.format(Messages.MESSAGE_PERSONS_LISTED_OVERVIEW, model.getFilteredPersonList().size());
return String.format(Messages.MESSAGE_CONTACTS_LISTED_OVERVIEW, model.getFilteredPersonList().size());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class ListCommand extends Command {

public static final String COMMAND_WORD = "list";

public static final String MESSAGE_SUCCESS = "Listed all persons";
public static final String MESSAGE_SUCCESS = "Listed all contacts.";


@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/fields/Phone.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class Phone implements Field {

public static final Prefix PREFIX_PHONE = new Prefix("p\\");
private static final String MESSAGE_CONSTRAINTS = "Phone numbers should only contain numbers,"
private static final String MESSAGE_CONSTRAINTS = "Phone numbers should only contain numbers, "
+ "'+', '-', ',' and spaces, and it should be at least 3 characters long";
private static final String VALIDATION_REGEX = "[\\d\\-\\s+,]{3,}";
private final String phone;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/tag/Tag.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
public class Tag {

private static final String MESSAGE_CONSTRAINTS = "Tags cannot contain '\\', can only consist of"
private static final String MESSAGE_CONSTRAINTS = "Tags cannot contain '\\', can only consist of "
+ "alphabets and numbers, and should not be blank";
private static final String VALIDATION_REGEX = "\\p{Alnum}+";

Expand Down
4 changes: 2 additions & 2 deletions src/test/java/seedu/address/logic/LogicManagerTest.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package seedu.address.logic;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static seedu.address.logic.Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX;
import static seedu.address.logic.Messages.MESSAGE_INVALID_CONTACT_DISPLAYED_INDEX;
import static seedu.address.logic.Messages.MESSAGE_UNKNOWN_COMMAND;
import static seedu.address.testutil.Assert.assertThrows;

Expand Down Expand Up @@ -47,7 +47,7 @@ public void execute_invalidCommandFormat_throwsParseException() {
@Test
public void execute_commandExecutionError_throwsCommandException() {
String deleteCommand = "delete 9";
assertCommandException(deleteCommand, MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
assertCommandException(deleteCommand, MESSAGE_INVALID_CONTACT_DISPLAYED_INDEX);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void execute_newPerson_success() {
public void execute_duplicatePerson_throwsCommandException() {
Person personInList = model.getAddressBook().getPersonList().get(0);
assertCommandFailure(new AddCommand(personInList), model,
AddCommand.MESSAGE_DUPLICATE_PERSON);
AddCommand.MESSAGE_DUPLICATE_CONTACT);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public void execute_duplicatePerson_throwsCommandException() {
AddCommand addCommand = new AddCommand(validPerson);
ModelStub modelStub = new ModelStubWithPerson(validPerson);

assertThrows(CommandException.class, AddCommand.MESSAGE_DUPLICATE_PERSON, () -> addCommand.execute(modelStub));
assertThrows(CommandException.class, AddCommand.MESSAGE_DUPLICATE_CONTACT, () -> addCommand.execute(modelStub));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void execute_validIndexUnfilteredList_success() {
Person personToDelete = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased());
DeleteCommand deleteCommand = new DeleteCommand(INDEX_FIRST_PERSON);

String expectedMessage = String.format(DeleteCommand.MESSAGE_DELETE_PERSON_SUCCESS,
String expectedMessage = String.format(DeleteCommand.MESSAGE_DELETE_CONTACT_SUCCESS,
Messages.format(personToDelete));

ModelManager expectedModel = new ModelManager(model.getAddressBook(), new UserPrefs());
Expand All @@ -49,7 +49,7 @@ public void execute_invalidIndexUnfilteredList_throwsCommandException() {
Index outOfBoundIndex = Index.fromOneBased(model.getFilteredPersonList().size() + 1);
DeleteCommand deleteCommand = new DeleteCommand(outOfBoundIndex);

assertCommandFailure(deleteCommand, model, Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
assertCommandFailure(deleteCommand, model, Messages.MESSAGE_INVALID_CONTACT_DISPLAYED_INDEX);
}

@Test
Expand All @@ -59,7 +59,7 @@ public void execute_validIndexFilteredList_success() {
Person personToDelete = model.getFilteredPersonList().get(INDEX_FIRST_PERSON.getZeroBased());
DeleteCommand deleteCommand = new DeleteCommand(INDEX_FIRST_PERSON);

String expectedMessage = String.format(DeleteCommand.MESSAGE_DELETE_PERSON_SUCCESS,
String expectedMessage = String.format(DeleteCommand.MESSAGE_DELETE_CONTACT_SUCCESS,
Messages.format(personToDelete));

Model expectedModel = new ModelManager(model.getAddressBook(), new UserPrefs());
Expand All @@ -79,7 +79,7 @@ public void execute_invalidIndexFilteredList_throwsCommandException() {

DeleteCommand deleteCommand = new DeleteCommand(outOfBoundIndex);

assertCommandFailure(deleteCommand, model, Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
assertCommandFailure(deleteCommand, model, Messages.MESSAGE_INVALID_CONTACT_DISPLAYED_INDEX);
}

@Test
Expand All @@ -89,7 +89,7 @@ public void execute_validIndexLastUnfilteredList_success() {
Person personToDelete = model.getFilteredPersonList().get(lastIndex.getZeroBased());
DeleteCommand deleteCommand = new DeleteCommand(lastIndex);

String expectedMessage = String.format(DeleteCommand.MESSAGE_DELETE_PERSON_SUCCESS,
String expectedMessage = String.format(DeleteCommand.MESSAGE_DELETE_CONTACT_SUCCESS,
Messages.format(personToDelete));

ModelManager expectedModel = new ModelManager(model.getAddressBook(), new UserPrefs());
Expand All @@ -111,7 +111,7 @@ public void execute_deleteInEmptyList_throwsCommandException() {
Index someIndex = Index.fromOneBased(1);
DeleteCommand deleteCommand = new DeleteCommand(someIndex);

assertCommandFailure(deleteCommand, emptyModel, Messages.MESSAGE_INVALID_PERSON_DISPLAYED_INDEX);
assertCommandFailure(deleteCommand, emptyModel, Messages.MESSAGE_INVALID_CONTACT_DISPLAYED_INDEX);
}

@Test
Expand Down
Loading

0 comments on commit 5b73e93

Please sign in to comment.