-
Notifications
You must be signed in to change notification settings - Fork 10
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
[T4A1][T1-04] Aung Swumm #112
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
* Represents a Person's email in the address book. | ||
* Guarantees: immutable; is valid as declared in {@link #isValidEmail(String)} | ||
*/ | ||
public class Email { | ||
public class Email implements Printable{ | ||
|
||
public static final String EXAMPLE = "[email protected]"; | ||
public static final String MESSAGE_EMAIL_CONSTRAINTS = | ||
|
@@ -42,6 +42,11 @@ public String toString() { | |
return value; | ||
} | ||
|
||
@Override | ||
public String getPrintableString() { | ||
return "Email: " + this.toString(); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
return other == this // short circuit if same object | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package seedu.addressbook.data.person; | ||
|
||
//an interface that allows user to access data on a read-only, immutable basis | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good that you write the header comment, but try to follow the coding standard for this. Check out ReadOnlyPerson interface for reference. |
||
public interface Printable { | ||
public abstract String getPrintableString(); | ||
|
||
public default String getPrintableString(Printable...printables) { | ||
StringBuilder printableString = new StringBuilder(); | ||
for (Printable _printable : printables) { | ||
printableString.append(_printable.getPrintableString()); | ||
} | ||
return printableString.toString(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This code shouldn't be here and also this method is never called. Discuss with your teammates. |
||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't you check whether it's private or not? When do you combine all the printables?