-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCampList.java
70 lines (58 loc) · 1.46 KB
/
CampList.java
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import java.util.ArrayList;
import java.util.UUID;
public class CampList {
private ArrayList<Camp> camps = new ArrayList<Camp>();
private static CampList campList;
private CampList() {
camps = DataLoader.loadCamps();
}
public static CampList getInstance() {
if (campList == null) {
campList = new CampList();
}
return campList;
}
public boolean addCamp(Camp camp) {
if (camps == null) {
return false;
} else {
camps.add(camp);
return true;
}
}
public Camp getCamp(String name) {
for (Camp c : camps) {
if (c.getName().equals(name)) {
return c;
}
}
return null;
}
public Group getGroupByUUID(UUID id) {
for (Camp camp : camps) {
for (Week week : camp.getWeeks()) {
for (Group group : week.getGroups()) {
if (group.getUuid().equals(id)) {
return group;
}
}
}
}
return null;
}
public ArrayList<Camp> getCamps() {
return camps;
}
public void saveCamps() {
DataWriter.saveCamps();
}
public void editGroup() {
}
public String toString() {
String allCamps = "";
for (Camp camp : camps) {
allCamps += camp + "\n";
}
return allCamps;
}
}