forked from nus-cs2103-AY1718S1/addressbook-level4-old
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix test case bug buy erik, set this as v1.3
- Loading branch information
Showing
23 changed files
with
287 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
import static seedu.address.logic.parser.CliSyntax.PREFIX_EMAIL; | ||
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_PROFILEPAGE; | ||
import static seedu.address.logic.parser.CliSyntax.PREFIX_TAG; | ||
|
||
import seedu.address.logic.commands.exceptions.CommandException; | ||
|
@@ -27,13 +28,15 @@ public class AddCommand extends UndoableCommand { | |
+ PREFIX_EMAIL + "EMAIL " | ||
+ PREFIX_BIRTHDAY + "BIRTHDAY " | ||
+ PREFIX_ADDRESS + "ADDRESS " | ||
+ PREFIX_PROFILEPAGE + "PROFILE PAGE " | ||
+ "[" + PREFIX_TAG + "TAG]...\n" | ||
+ "Example: " + COMMAND_WORD + " " | ||
+ PREFIX_NAME + "John Doe " | ||
+ PREFIX_PHONE + "98765432 " | ||
+ PREFIX_EMAIL + "[email protected] " | ||
+ PREFIX_BIRTHDAY + "1995/11/03 " | ||
+ PREFIX_ADDRESS + "311, Clementi Ave 2, #02-25 " | ||
+ PREFIX_PROFILEPAGE + "www.facebook.com " | ||
+ PREFIX_TAG + "friends " | ||
+ PREFIX_TAG + "owesMoney"; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
package seedu.address.model.person; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
|
||
import seedu.address.commons.exceptions.IllegalValueException; | ||
|
||
/** | ||
* Represents a Person's birthday in the address book. | ||
* Guarantees: immutable; is valid as declared in {@link #isValidProfilePage(String)} | ||
*/ | ||
public class ProfilePage { | ||
|
||
public static final String MESSAGE_PROFILEPAGE_CONSTRAINTS = | ||
"Person Profile page should be a valid URL pointing to that person's profile"; | ||
public static final String PROFILEPAGE_VALIDATION_REGEX = "^(https?:\\/\\/)?(www\\.)?([\\w]+\\.)+[\\w]{2,63}\\/?$"; | ||
|
||
public final String value; | ||
|
||
/** | ||
* Validates given birthday. | ||
* | ||
* @throws IllegalValueException if given birthday address string is invalid. | ||
*/ | ||
public ProfilePage(String profile) throws IllegalValueException { | ||
requireNonNull(profile); | ||
if (!isValidProfilePage(profile)) { | ||
throw new IllegalValueException(MESSAGE_PROFILEPAGE_CONSTRAINTS); | ||
} | ||
this.value = profile; | ||
} | ||
|
||
/** | ||
* Returns if a given string is a valid person birthday. | ||
*/ | ||
public static boolean isValidProfilePage(String test) { | ||
return test.matches(PROFILEPAGE_VALIDATION_REGEX); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return other == this // short circuit if same object | ||
|| (other instanceof ProfilePage // instanceof handles nulls | ||
&& this.value.equals(((ProfilePage) other).value)); // state check | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return value.hashCode(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.