-
Notifications
You must be signed in to change notification settings - Fork 0
/
FAQList.java
70 lines (61 loc) · 1.46 KB
/
FAQList.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;
/**
* A FAQList
* @author: J TEA: Tessa Neal, Eve Blom, Anna Phan, and Jacqueline Askey
*/
public class FAQList {
private static ArrayList<FAQ> FAQs;
private static FAQList FAQList;
/**
* Creates a new ArrayList of FAQ
*/
public FAQList() {
FAQs = DataLoader.getFAQs();
}
/**
* Checks if there is a FAQList and if it isn't, it makes a new one.
* If there is, it returns it.
* @return an instance of FAQList
*/
public static FAQList getInstance() {
if(FAQList == null){
FAQList = new FAQList();
}
return FAQList;
}
/**
* Adds a FAQ to the ArrayList FAQs
* @param question a question
*/
public void addFAQ(Question question) {
FAQs.add(new FAQ(question));
}
/**
* Adds a FAQ to the ArrayList FAQs
* @param question a question
*/
public void addFAQ(String question) {
FAQs.add(new FAQ(question));
}
/**
* Return ArrayList of FAQs
* @return ArrayList of FAQs
*/
public ArrayList<FAQ> getFAQ(){
return FAQs;
}
/**
* Returns details of the FAQ
* @return A string representation of a FAQ
*/
public String FAQstoString() {
String result = "";
for(FAQ faq : FAQs) {
result += faq.toString();
}
return result;
}
public int size() {
return FAQs.size();
}
}