-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBloodType.java
More file actions
28 lines (23 loc) · 803 Bytes
/
BloodType.java
File metadata and controls
28 lines (23 loc) · 803 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package BloodMatch.src.bloodmatch;
// an enumitaror class, which holds and manages the blood data.
enum BloodType {
A_POS, A_NEG, B_POS, B_NEG, AB_POS, AB_NEG, O_POS, O_NEG;
private static String name;
// method, which returns specific blood type.
public static String parseType(String type) {
if (typeExists(type)) {
return type.toUpperCase();
}
return "UNDEFINED";
}
// method, which checks if blood type matches in enuminator.
public static boolean typeExists(String type) {
for (BloodType bloodType : BloodType.values()) {
name = bloodType.toString();
if (name.equalsIgnoreCase(type)) {
return true;
}
}
return false;
}
}