Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve code quality for logic components #260

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/commands/AddCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import seedu.address.model.person.Person;

/**
* Adds a person to the address book.
* Adds a person to the patient records.
*/
public class AddCommand extends Command {

Expand Down Expand Up @@ -57,7 +57,7 @@ public class AddCommand extends Command {
private final Person toAdd;

/**
* Creates an AddCommand to add the specified {@code Person}
* Creates an AddCommand to add the specified {@code Person}.
*/
public AddCommand(Person person) {
requireNonNull(person);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import seedu.address.storage.UserPrefsStorage;

/**
* Backs up the data to a specified index
* Backs up the data to a specified index.
*/
public class BackupCommand extends Command {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import seedu.address.model.Model;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import seedu.address.storage.UserPrefsStorage;

/**
* Deletes a backup from a specified index
* Deletes a backup from a specified index.
*/
public class DeleteBackupCommand extends Command {

Expand All @@ -36,7 +36,7 @@ public class DeleteBackupCommand extends Command {
private final Path backupDataPath = Path.of("data/backup/backupData.json");

/**
* @param index of the backup file
* @param index of the backup file.
*/
public DeleteBackupCommand(Index index) {
requireAllNonNull(index);
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/seedu/address/logic/commands/DeleteCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


/**
* Deletes person(s) identified by their NRIC from the address book. (at least one NRIC to be supplied)
* Deletes person(s) identified by their NRIC from the patient records. (at least one NRIC to be supplied)
*/
public class DeleteCommand extends Command {

Expand All @@ -34,22 +34,22 @@ public DeleteCommand(Set<Nric> nricList) {

@Override
public CommandResult execute(Model model) throws CommandException {
boolean throwException = false;
boolean isMissing = false;
String errorMessage = "";
String deletedPersonMessage = MESSAGE_DELETE_PERSON_SUCCESS;
requireNonNull(model);

for (Nric nric: nricList) {
Person personToDelete = model.findPersonByNric(nric);
if (personToDelete == null) {
throwException = true;
isMissing = true;
errorMessage += String.format(Messages.MESSAGE_NRIC_DOES_NOT_EXIST, nric);
} else {
model.deletePerson(personToDelete);
deletedPersonMessage += String.format("%s\n", nric);
}
}
if (throwException) {
if (isMissing) {
throw new CommandException(errorMessage);
}
return new CommandResult(deletedPersonMessage);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
import seedu.address.model.tag.Tag;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import seedu.address.model.person.Person;

/**
* Finds and lists all persons in address book whose name contains any of the argument keywords.
* Finds and lists all persons in patient records whose name contains any of the argument keywords.
* Keyword matching is case-insensitive.
*/
public class FindCommand extends Command {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import seedu.address.model.Model;

/**
* Lists all persons in the address book to the user.
* Lists all persons in the patient records to the user.
*/
public class ListCommand extends Command {

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/seedu/address/logic/commands/LoadCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import seedu.address.storage.JsonAddressBookStorage;

/**
* Loads the data from a specified backup
* Loads the data from a specified backup.
*/
public class LoadCommand extends Command {

Expand All @@ -36,7 +36,7 @@ public class LoadCommand extends Command {
private final Backup backup;

/**
* @param index of the backup file
* @param index of the backup file.
*/
public LoadCommand(Index index) {
requireAllNonNull(index);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import seedu.address.model.Model;

/**
* Shows all the available backups to the user
* Shows all the available backups to the user.
*/
public class ViewBackupsCommand extends Command {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@
import seedu.address.model.tag.Tag;

/**
* Parses input arguments and creates a new AddCommand object
* Parses input arguments and creates a new AddCommand object.
*/
public class AddCommandParser implements Parser<AddCommand> {

/**
* Parses the given {@code String} of arguments in the context of the AddCommand
* and returns an AddCommand object for execution.
*
* @throws ParseException if the user input does not conform the expected format
* @throws ParseException if the user input does not conform the expected format.
*/
public AddCommand parse(String args) throws ParseException {
ArgumentMultimap argMultimap =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
import seedu.address.logic.parser.exceptions.ParseException;

/**
* Parses input arguments and creates a new {@code BackupCommand} object
* Parses input arguments and creates a new {@code BackupCommand} object.
*/
public class BackupCommandParser implements Parser<BackupCommand> {
/**
* Parses the given {@code String} of arguments in the context of the {@code BackupCommand}
* and returns a {@code BackupCommand} object for execution.
*
* @throws ParseException if the user input does not conform the expected format
* @throws ParseException if the user input does not conform the expected format.
*/
public BackupCommand parse(String args) throws ParseException {
requireNonNull(args);
Expand All @@ -38,7 +38,7 @@ public BackupCommand parse(String args) throws ParseException {
}

/**
* Returns true if a given index is a valid
* Returns true if a given index is valid.
*/
public static boolean isValidIndex(Index test) {
return test.getOneBased() <= 10 && test.getOneBased() > 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
import seedu.address.logic.parser.exceptions.ParseException;

/**
* Parses input arguments and creates a new DeleteBackupCommand object
* Parses input arguments and creates a new DeleteBackupCommand object.
*/
public class DeleteBackupCommandParser implements Parser<DeleteBackupCommand> {

/**
* Parses the given {@code String} of arguments in the context of the DeleteCommand
* and returns an DeleteCommand object for execution.
*
* @throws ParseException if the user input does not conform the expected format
* @throws ParseException if the user input does not conform the expected format.
*/
public DeleteBackupCommand parse(String args) throws ParseException {
requireNonNull(args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
import seedu.address.model.person.Nric;

/**
* Parses input arguments and creates a new DeleteCommand object
* Parses input arguments and creates a new DeleteCommand object.
*/
public class DeleteCommandParser implements Parser<DeleteCommand> {

/**
* Parses the given {@code String} of arguments in the context of the DeleteCommand
* and returns a DeleteCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
* @throws ParseException if the user input does not conform the expected format.
*/
public DeleteCommand parse(String args) throws ParseException {
ArgumentMultimap argMultimap =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@
import seedu.address.model.tag.Tag;

/**
* Parses input arguments and creates a new EditCommand object
* Parses input arguments and creates a new EditCommand object.
*/
public class EditCommandParser implements Parser<EditCommand> {

/**
* Parses the given {@code String} of arguments in the context of the EditCommand
* and returns an EditCommand object for execution.
*
* @throws ParseException if the user input does not conform the expected format
* @throws ParseException if the user input does not conform the expected format.
*/
public EditCommand parse(String args) throws ParseException {
requireNonNull(args);
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/seedu/address/logic/parser/FindCommandParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@


/**
* Parses input arguments and creates a new FindCommand object
* Parses input arguments and creates a new FindCommand object.
*/
public class FindCommandParser implements Parser<FindCommand> {
/**
* Parses the given {@code String} of arguments in the context of the FindCommand
* and returns a FindCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
* @throws ParseException if the user input does not conform the expected format.
*/

public FindCommand parse(String args) throws ParseException {
Expand Down Expand Up @@ -106,10 +106,10 @@ private static boolean moreThanOnePrefixPresent(ArgumentMultimap argumentMultima
}

/**
* Checks if argument is empty before splitting argument
* Checks if argument is empty before splitting argument.
*
* @param arg argument passed by user
* @return argument split into an array of strings
* @param arg argument passed by user.
* @return argument split into an array of strings.
* @throws ParseException
*/
private static String[] getKeywords(String arg) throws ParseException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
import seedu.address.logic.parser.exceptions.ParseException;

/**
* Parses input arguments and creates a new {@code LoadCommand} object
* Parses input arguments and creates a new {@code LoadCommand} object.
*/
public class LoadCommandParser implements Parser<LoadCommand> {
/**
* Parses the given {@code String} of arguments in the context of the {@code LoadCommand}
* and returns a {@code LoadCommand} object for execution.
*
* @throws ParseException if the user input does not conform the expected format
* @throws ParseException if the user input does not conform the expected format.
*/
public LoadCommand parse(String args) throws ParseException {
requireNonNull(args);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/logic/parser/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public interface Parser<T extends Command> {

/**
* Parses {@code userInput} into a command and returns it.
* @throws ParseException if {@code userInput} does not conform the expected format
* @throws ParseException if {@code userInput} does not conform the expected format.
*/
T parse(String userInput) throws ParseException;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@


/**
* Parses input arguments and creates a new ViewCommand object
* Parses input arguments and creates a new ViewCommand object.
*/
public class ViewCommandParser implements Parser<ViewCommand> {

/**
* Parses the given {@code String} of arguments in the context of the ViewCommand
* and returns a ViewCommand object for execution.
* @throws ParseException if the user input does not conform the expected format
* @throws ParseException if the user input does not conform the expected format.
*/
public ViewCommand parse(String args) throws ParseException {
ArgumentMultimap argMultimap =
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/Address.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static seedu.address.commons.util.AppUtil.checkArgument;

/**
* Represents a Person's address in the address book.
* Represents a Person's address in the patient records.
* Guarantees: immutable; is valid as declared in {@link #isValidAddress(String)}
*/
public class Address {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/DateOfBirth.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


/**
* Represents a Person's date of birth in the address book.
* Represents a Person's date of birth in the patient records.
* Guarantees: immutable; is valid as declared in {@link #isValidDate(String)}
*/
public class DateOfBirth {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/Doctor.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static seedu.address.commons.util.AppUtil.checkArgument;

/**
* Represents a Person's attending Doctor in the address book.
* Represents a Person's attending Doctor in the patient records.
* Guarantees: immutable; is valid as declared in {@link #isValidDoctor(String)}
*/
public class Doctor {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/DrugAllergy.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static seedu.address.commons.util.AppUtil.checkArgument;

/**
* Represents a Person's NRIC in the address book.
* Represents a Person's drug alllergy in the patient records.
* Guarantees: immutable; is valid as declared in {@link #isValidDrugAllergy(String)}
*/
public class DrugAllergy {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/Email.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import static seedu.address.commons.util.AppUtil.checkArgument;

/**
* Represents a Person's email in the address book.
* Represents a Person's email in the patient records.
* Guarantees: immutable; is valid as declared in {@link #isValidEmail(String)}
*/
public class Email {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/Gender.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static seedu.address.commons.util.AppUtil.checkArgument;

/**
* Represents a Person's gender in the address book.
* Represents a Person's gender in the patient records.
* Guarantees: immutable; is valid as declared in {@link #isValidGender(String)}
*/
public class Gender {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/Name.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static seedu.address.commons.util.AppUtil.checkArgument;

/**
* Represents a Person's name in the address book.
* Represents a Person's name in the patient records.
* Guarantees: immutable; is valid as declared in {@link #isValidName(String)}
*/
public class Name {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/Nric.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import static seedu.address.commons.util.AppUtil.checkArgument;

/**
* Represents a Person's NRIC in the address book.
* Represents a Person's NRIC in the patient records.
* Guarantees: immutable; is valid as declared in {@link #isValidNric(String)}
*/
public class Nric {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/person/Person.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import seedu.address.model.tag.Tag;

/**
* Represents a Person in the address book.
* Represents a Person in the patient records.
* Guarantees: details are present and not null, field values are validated, immutable.
*/
public class Person {
Expand Down
Loading