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

[W5][W16-03]Fan Dongzhe #110

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

FanDongzhe
Copy link

It's a simple test

@FanDongzhe
Copy link
Author

new command

@ZhangJiayu0303
Copy link

Yes, telephone number is unique. You can find the exact person through their phone number.
Maybe you can also consider to create some commands such as findAddress, findTags.
Good job!

Copy link

@lestertj lestertj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall, this is a good attempt. Take note of the coding conventions, because Java does practice quite different coding conventions from C++. Also, please include tests to verify the functionality of your code


import seedu.addressbook.data.person.ReadOnlyPerson;

public class FindByPhone extends Command

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow the naming convention in the other Command files, so this class should be something like FindByPhoneCommand or FindByPhoneNumberCommand

import seedu.addressbook.data.person.ReadOnlyPerson;

public class FindByPhone extends Command
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the coding convention. This curly brace should appear at the end of the previous line ... extends Command {

private final Set<String> keywords;

public FindByPhone(Set<String> keywords)
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curly brace on previous line, as above

{
public static final String COMMAND_WORD = "find by phone number";

public static final String MESSAGE_USAGE = COMMAND_WORD + "Finds all persons whose phone number is" + "the specified keywords (case-sensitive) and displays them as a list with index numbers.\n"+ "Parameters: KEYWORD [MORE_KEYWORDS]...\n"+ "Example" + COMMAND_WORD + "alice";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, but won't this be printed as ... phone number isthe specified ...?

@@ -35,6 +38,9 @@ public Phone(String phone, boolean isPrivate) throws IllegalValueException {
public static boolean isValidPhone(String test) {
return test.matches(PHONE_VALIDATION_REGEX);
}
public List<String> getPhone() {
return Arrays.asList(value.split("\\s+"));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the regex, the phone number can only be a string of digits. Then, there is no need to split on whitespace (since there will be none). Also, is it necessary to return the results in a list? Since there will only be 1 string.

@@ -74,4 +74,8 @@ public boolean equals(Object other) {
|| (other instanceof AddressBook // instanceof handles nulls
&& this.allPersons.equals(((AddressBook) other).allPersons));
}
private static void helloworld()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please leave a newline between functions. Also, there's a double space between your private and static

@@ -126,6 +126,10 @@ private StorageFile initializeStorage(String[] launchArgs) throws InvalidStorage
boolean isStorageFileSpecifiedByUser = launchArgs.length > 0;
return isStorageFileSpecifiedByUser ? new StorageFile(launchArgs[0]) : new StorageFile();
}
private static void helloworld()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This shouldn't be here, should it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants