Skip to content

Commit

Permalink
Fix CheckStyle Issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wujy28 committed Oct 17, 2023
1 parent 9e0710c commit fe15562
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 39 deletions.
24 changes: 19 additions & 5 deletions src/main/java/seedu/address/logic/parser/AddCommandParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@

import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.Messages.MESSAGE_REQUIRED_COMMAND_NOT_FOUND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.*;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_BIRTHDAY;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_GENDER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_IC_NUMBER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;

import java.util.ArrayList;
import java.util.Arrays;
Expand All @@ -13,7 +20,14 @@

import seedu.address.logic.commands.AddCommand;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.model.patient.*;
import seedu.address.model.patient.Address;
import seedu.address.model.patient.Birthday;
import seedu.address.model.patient.Email;
import seedu.address.model.patient.Gender;
import seedu.address.model.patient.IcNumber;
import seedu.address.model.patient.Name;
import seedu.address.model.patient.Patient;
import seedu.address.model.patient.Phone;
import seedu.address.model.tag.Tag;

/**
Expand All @@ -23,8 +37,8 @@ public class AddCommandParser implements Parser<AddCommand> {

public static final Prefix[] RELEVANT_PREFIXES = new Prefix[]{PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL,
PREFIX_GENDER, PREFIX_IC_NUMBER, PREFIX_BIRTHDAY, PREFIX_ADDRESS, PREFIX_TAG};
public static final Prefix[] RELEVANT_PREFIXES_WITHOUT_TAG = new Prefix[]{PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL
, PREFIX_GENDER, PREFIX_IC_NUMBER, PREFIX_BIRTHDAY, PREFIX_ADDRESS};
public static final Prefix[] RELEVANT_PREFIXES_WITHOUT_TAG = new Prefix[]{PREFIX_NAME, PREFIX_PHONE, PREFIX_EMAIL,
PREFIX_GENDER, PREFIX_IC_NUMBER, PREFIX_BIRTHDAY, PREFIX_ADDRESS};
public static final Prefix[] REQUIRED_PREFIXES = new Prefix[]{PREFIX_NAME};

public static final Prefix[] OPTIONAL_PREFIXES = new Prefix[]{PREFIX_PHONE, PREFIX_EMAIL, PREFIX_GENDER,
Expand Down Expand Up @@ -60,7 +74,7 @@ public static Prefix[] getPrefixesPresent(ArgumentMultimap argMultimap) {
* @throws ParseException if the user input does not conform the expected format
*/
public static Patient createPatientFromPrefixes(ArgumentMultimap argMultimap, Prefix[] prefixes)
throws ParseException {
throws ParseException {
// filling the fields with default values
Name name = ParserUtil.parseName(argMultimap.getValue(PREFIX_NAME).get());
Phone phone = new Phone(Phone.DEFAULT_PHONE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@
import static seedu.address.logic.Messages.MESSAGE_INVALID_COMMAND_FORMAT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_ADDRESS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_BIRTHDAY;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DEPARTMENT;
import static seedu.address.logic.parser.CliSyntax.PREFIX_DIAGNOSIS;
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL;
import static seedu.address.logic.parser.CliSyntax.PREFIX_GENDER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_IC_NUMBER;
import static seedu.address.logic.parser.CliSyntax.PREFIX_INITIAL_OBSERVATION;
import static seedu.address.logic.parser.CliSyntax.PREFIX_NAME;
import static seedu.address.logic.parser.CliSyntax.PREFIX_PHONE;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG;
import static seedu.address.logic.parser.CliSyntax.PREFIX_TREATMENT_PLAN;

import java.util.Collection;
import java.util.Collections;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/patient/Address.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public class Address {
* otherwise " " (a blank string) becomes a valid input.
*/
public static final String VALIDATION_REGEX = "[^\\s].*";
public static final String DEFAULT_ADDRESS = "No address was added";

public final String value;
public static String DEFAULT_ADDRESS = "No address was added";

/**
* Constructs an {@code Address}.
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/patient/Age.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class Age {
public static final String MESSAGE_CONSTRAINTS =
"Age should only contain numbers, and it should not be negative";
public static final String VALIDATION_REGEX = "\\d+";
public static String DEFAULT_AGE = "00";
public static final String DEFAULT_AGE = "00";
public final String value;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/patient/Birthday.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ public class Birthday {
public static final String MESSAGE_CONSTRAINTS =
"Birth dates should only contain numbers in valid dd/MM/yyyy format";
public static final String VALIDATION_REGEX = "\\d{1,2}\\/\\d{1,2}\\/\\d{2,4}";
public static final String DEFAULT_BIRTHDAY = "01/01/2000";
public final LocalDate value;
public final String strValue;
private DateTimeFormatter formatter = DateTimeFormatter.ofPattern("dd/MM/yyyy");
public static String DEFAULT_BIRTHDAY = "01/01/2000";
/**
* Constructs a {@code Birthday}.
*
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/seedu/address/model/patient/Email.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/
public class Email {

public static final String DEFAULT_EMAIL = "default_email@gmail.com";
private static final String SPECIAL_CHARACTERS = "+_.-";
public static final String MESSAGE_CONSTRAINTS = "Emails should be of the format local-part@domain "
+ "and adhere to the following constraints:\n"
Expand All @@ -30,7 +31,7 @@ public class Email {
private static final String DOMAIN_LAST_PART_REGEX = "(" + DOMAIN_PART_REGEX + "){2,}$"; // At least two chars
private static final String DOMAIN_REGEX = "(" + DOMAIN_PART_REGEX + "\\.)*" + DOMAIN_LAST_PART_REGEX;
public static final String VALIDATION_REGEX = LOCAL_PART_REGEX + "@" + DOMAIN_REGEX;
public static String DEFAULT_EMAIL = "default_email@gmail.com";

public final String value;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/patient/Gender.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class Gender {
"Gender should only be MALE, FEMALE or OTHER, and it should not be blank";

public static final String VALIDATION_REGEX = "\\p{Alnum}*";
public static String DEFAULT_GENDER = "OTHER";
public static final String DEFAULT_GENDER = "OTHER";
public final String value;

enum Genders {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/patient/IcNumber.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class IcNumber {
public static final String MESSAGE_CONSTRAINTS =
"IC Number should start and end with an alphabet with non negative numbers in between";
public static final String VALIDATION_REGEX = "^[A-Z]\\d{7}[A-Z]$";
public static String DEFAULT_IC_NUMBER = "t0000000a";
public static final String DEFAULT_IC_NUMBER = "t0000000a";
public final String value;

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/model/patient/Phone.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public class Phone {
public static final String MESSAGE_CONSTRAINTS =
"Phone numbers should only contain numbers, and it should be at least 3 digits long";
public static final String VALIDATION_REGEX = "\\d{3,}";
public static String DEFAULT_PHONE = "00000000";
public static final String DEFAULT_PHONE = "00000000";
public final String value;

/**
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/seedu/address/model/patient/Record.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
*/
public class Record {

public static String DEFAULT_INITIAL_OBSERVATIONS = "No initial observations given";
public static String DEFAULT_DIAGNOSIS = "No diagnosis given";
public static String DEFAULT_TREATMENT_PLAN = "No treatment plan given";
public static final String DEFAULT_INITIAL_OBSERVATIONS = "No initial observations given";
public static final String DEFAULT_DIAGNOSIS = "No diagnosis given";
public static final String DEFAULT_TREATMENT_PLAN = "No treatment plan given";

private final Patient patient;
private String initialObservations;
Expand All @@ -27,6 +27,9 @@ public Record(Patient patient) {
this.treatmentPlan = DEFAULT_TREATMENT_PLAN;
}

/**
* Initializes a Record with a null patient and initialise the fields with default values
*/
public Record() {
this.patient = null; // patient left null, would have to fix when building editing record command
this.initialObservations = DEFAULT_INITIAL_OBSERVATIONS;
Expand Down
52 changes: 34 additions & 18 deletions src/main/java/seedu/address/model/util/SampleDataUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,47 @@

import seedu.address.model.AddressBook;
import seedu.address.model.ReadOnlyAddressBook;
import seedu.address.model.patient.*;
import seedu.address.model.patient.Address;
import seedu.address.model.patient.Birthday;
import seedu.address.model.patient.Email;
import seedu.address.model.patient.Gender;
import seedu.address.model.patient.IcNumber;
import seedu.address.model.patient.Name;
import seedu.address.model.patient.Patient;
import seedu.address.model.patient.Phone;
import seedu.address.model.tag.Tag;

/**
* Contains utility methods for populating {@code AddressBook} with sample data.
*/
public class SampleDataUtil {
public static Patient[] getSamplePatients() {
return new Patient[]{new Patient(new Name("Alex Yeoh"), new Phone("87438807"),
new Email("alexyeoh@example.com"), new Gender("Male"), new IcNumber("t7654321a"),
new Birthday("05/05/2005"), new Address("Blk 30 Geylang " + "Street " + "29, #06-40"),
getTagSet("friends")), new Patient(new Name("Bernice Yu"), new Phone("99272758"),
new Email("berniceyu@example.com"), new Gender("Female"), new IcNumber("s1234567b"),
new Birthday("06/06/1990"), new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"),
getTagSet("colleagues", "friends")), new Patient(new Name("Charlotte Oliveiro"), new Phone("93210283"),
new Email("charlotte@example.com"), new Gender("Other"), new IcNumber("t1357912g"),
new Birthday("12/12/1989"), new Address("Blk 11 Ang Mo Kio Street 74, #11-04"),
getTagSet("neighbours")), new Patient(new Name("David Li"), new Phone("91031282"),
new Email("lidavid@example.com"), new Gender("Male"), new IcNumber("s7654321p"), new Birthday("01/01/2001"),
new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), getTagSet("family")), new Patient(
new Name("Irfan Ibrahim"), new Phone("92492021"), new Email("irfan@example.com"), new Gender("Male"),
new IcNumber("s0987654e"), new Birthday("10/10/2000"), new Address("Blk 47 Tampines Street 20, #17-35"),
getTagSet("classmates")), new Patient(new Name("Roy Balakrishnan"), new Phone("92624417"),
new Email("royb@example.com"), new Gender("Male"), new IcNumber("t6789031q"), new Birthday("07/11/1976"),
new Address("Blk 45 Aljunied Street 85, #11-31"), getTagSet("colleagues"))};
return new Patient[]{
new Patient(new Name("Alex Yeoh"), new Phone("87438807"),
new Email("alexyeoh@example.com"), new Gender("Male"), new IcNumber("t7654321a"),
new Birthday("05/05/2005"), new Address("Blk 30 Geylang " + "Street " + "29, #06-40"),
getTagSet("friends")),
new Patient(new Name("Bernice Yu"), new Phone("99272758"),
new Email("berniceyu@example.com"), new Gender("Female"), new IcNumber("s1234567b"),
new Birthday("06/06/1990"), new Address("Blk 30 Lorong 3 Serangoon Gardens, #07-18"),
getTagSet("colleagues", "friends")),
new Patient(new Name("Charlotte Oliveiro"), new Phone("93210283"),
new Email("charlotte@example.com"), new Gender("Other"), new IcNumber("t1357912g"),
new Birthday("12/12/1989"), new Address("Blk 11 Ang Mo Kio Street 74, #11-04"),
getTagSet("neighbours")),
new Patient(new Name("David Li"), new Phone("91031282"),
new Email("lidavid@example.com"), new Gender("Male"),
new IcNumber("s7654321p"), new Birthday("01/01/2001"),
new Address("Blk 436 Serangoon Gardens Street 26, #16-43"), getTagSet("family")),
new Patient(new Name("Irfan Ibrahim"), new Phone("92492021"),
new Email("irfan@example.com"), new Gender("Male"),
new IcNumber("s0987654e"), new Birthday("10/10/2000"),
new Address("Blk 47 Tampines Street 20, #17-35"),
getTagSet("classmates")),
new Patient(new Name("Roy Balakrishnan"), new Phone("92624417"),
new Email("royb@example.com"), new Gender("Male"),
new IcNumber("t6789031q"), new Birthday("07/11/1976"),
new Address("Blk 45 Aljunied Street 85, #11-31"), getTagSet("colleagues"))};
}

public static ReadOnlyAddressBook getSampleAddressBook() {
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/seedu/address/storage/JsonAdaptedPatient.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,14 @@
import com.fasterxml.jackson.annotation.JsonProperty;

import seedu.address.commons.exceptions.IllegalValueException;
import seedu.address.model.patient.*;
import seedu.address.model.patient.Address;
import seedu.address.model.patient.Birthday;
import seedu.address.model.patient.Email;
import seedu.address.model.patient.Gender;
import seedu.address.model.patient.IcNumber;
import seedu.address.model.patient.Name;
import seedu.address.model.patient.Patient;
import seedu.address.model.patient.Phone;
import seedu.address.model.tag.Tag;

/**
Expand Down
11 changes: 10 additions & 1 deletion src/test/java/seedu/address/testutil/PatientBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,16 @@
import java.util.HashSet;
import java.util.Set;

import seedu.address.model.patient.*;
import seedu.address.model.patient.Address;
import seedu.address.model.patient.AssignedDepartment;
import seedu.address.model.patient.Birthday;
import seedu.address.model.patient.Email;
import seedu.address.model.patient.Gender;
import seedu.address.model.patient.IcNumber;
import seedu.address.model.patient.Name;
import seedu.address.model.patient.Patient;
import seedu.address.model.patient.Phone;
import seedu.address.model.patient.Record;
import seedu.address.model.tag.Tag;
import seedu.address.model.util.SampleDataUtil;

Expand Down

0 comments on commit fe15562

Please sign in to comment.