forked from AY2324S2-CS2103-F15-2/tp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
17423e2
commit 5632538
Showing
13 changed files
with
248 additions
and
7 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
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,61 @@ | ||
package seedu.address.model.person; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.commons.util.AppUtil.checkArgument; | ||
|
||
/** | ||
* Represents a Student's attendance status in the address book. | ||
* | ||
*/ | ||
public class Attendance { | ||
|
||
public static final String MESSAGE_CONSTRAINTS = | ||
"Attendance should only be 'Present' or 'Absent', and it should not be blank"; | ||
public static final String VALIDATION_REGEX = "(?i)(present|absent)"; | ||
public final String value; | ||
|
||
/** | ||
* Creates an undefined attendance status for the student. | ||
*/ | ||
public Attendance() { | ||
value = "-"; | ||
} | ||
|
||
/** | ||
* Creates an attendance status for a student. | ||
* | ||
* @param status Attendance status ('Present' or 'Absent'). | ||
*/ | ||
public Attendance(String status) { | ||
requireNonNull(status); | ||
checkArgument(isValidAttendance(status), MESSAGE_CONSTRAINTS); | ||
value = status; | ||
} | ||
|
||
/** | ||
* Returns true if a given string is a valid attendance status. | ||
*/ | ||
public static boolean isValidAttendance(String test) { | ||
return test.matches(VALIDATION_REGEX); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (other == this) { | ||
return true; | ||
} | ||
|
||
// instanceof handles nulls | ||
if (!(other instanceof Attendance)) { | ||
return false; | ||
} | ||
|
||
Attendance otherAttendance = (Attendance) other; | ||
return value.equalsIgnoreCase(otherAttendance.value); | ||
} | ||
} |
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,60 @@ | ||
package seedu.address.model.person; | ||
|
||
import static java.util.Objects.requireNonNull; | ||
import static seedu.address.commons.util.AppUtil.checkArgument; | ||
|
||
/** | ||
* Represents a Student's payment status in the address book. | ||
* Guarantees: immutable; is always valid | ||
*/ | ||
public class Payment { | ||
public static final String MESSAGE_CONSTRAINTS = | ||
"Payment should only be 'Paid' or 'Not Paid', and it should not be blank"; | ||
public static final String VALIDATION_REGEX = "(?i)(paid|not paid)"; | ||
public final String value; | ||
|
||
/** | ||
* Creates an undefined payment status for the student. | ||
*/ | ||
public Payment() { | ||
value = "-"; | ||
} | ||
|
||
/** | ||
* Creates a payment status for a student. | ||
* | ||
* @param status Payment status ('Paid' or 'Not Paid'). | ||
*/ | ||
public Payment(String status) { | ||
requireNonNull(status); | ||
checkArgument(isValidPayment(status), MESSAGE_CONSTRAINTS); | ||
value = status; | ||
} | ||
|
||
/** | ||
* Returns true if a given string is a valid payment status. | ||
*/ | ||
public static boolean isValidPayment(String test) { | ||
return test.matches(VALIDATION_REGEX); | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return value; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object other) { | ||
if (other == this) { | ||
return true; | ||
} | ||
|
||
// instanceof handles nulls | ||
if (!(other instanceof Payment)) { | ||
return false; | ||
} | ||
|
||
Payment otherPayment = (Payment) other; | ||
return value.equalsIgnoreCase(otherPayment.value); | ||
} | ||
} |
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.