-
Notifications
You must be signed in to change notification settings - Fork 0
/
Module.java
100 lines (92 loc) · 3.36 KB
/
Module.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
//Module stores all information about learning modules
//Module types, active Modules, Module page keys, Module
public class Module
{
public static String[] MATTYPE_BUTTON_IMAGES = { "tut", "p_test", "u_test" };
private String firstPageIndex = "1";
private static Module activeModule;
public static Module getActiveModule(){
return activeModule;
}
public static boolean setActiveModule(String key){
activeModule = Resource_Manager.modules.get(key);
currentPage = 1;
return activeModule != null;
}
public static String getCurrentPageKey(){
return activeModule.pageKey;
}
public static String getNextPageKey(){
currentPage++;
return getCurrentPageKey() + String.valueOf(currentPage);
}
public static String getPreviousPageKey(){
currentPage--;
return getCurrentPageKey() + String.valueOf(currentPage);
}
public static int currentPage;
public String pageKey;
public String topic;
public String subTopic;
public int numPages;
public ModuleType moduleType;
//public ModuleCatagory moduleCatagory = ModuleCatagory.PRAC_TEST;
public Module(String pageKey, String topic, String subTopic, ModuleType moduleType)
{
this.pageKey = pageKey;
this.topic = topic;
this.subTopic = subTopic;
this.moduleType = moduleType;
}
public Module(String pageKey, String topic, String subTopic, ModuleType moduleType, int numPages)
{
this(pageKey, topic, subTopic, moduleType);
this.numPages = numPages;
if(moduleType == ModuleType.PRAC_TEST_MULTI){
//this.moduleCatagory = ModuleCatagory.UNIT_TEST;
for(int p = 1; p <= numPages; p++){
String pk = pageKey + String.valueOf(p);
GUI_Manager.guiPages.put(pk, new TestLayout(pk, topic));
}
}
else if(moduleType == ModuleType.TUTORIAL){
//this.moduleCatagory = ModuleCatagory.TUTORIAL;
for(int p = 1; p <= numPages; p++){
String pk = pageKey + String.valueOf(p);
GUI_Manager.guiPages.put(pk, new TutorialLayout(pk, topic));
}
}
/* else if(moduleType == ModuleType.PRAC_TEST_RNG_SHAPE){
GUI_Manager.guiPages.put(pageKey, new TestCountLayout(pageKey, topic, numPages));
} */
}
public Module(String pageKey, String topic, String subTopic, ModuleType moduleType, int numPages, int maxEquationValue)
{
this(pageKey, topic, subTopic, moduleType);
this.numPages = numPages;
System.out.printf("adding rng shape: %s\n", pageKey);
GUI_Manager.guiPages.put(pageKey, new TestCountLayout(pageKey, topic, maxEquationValue, numPages));
}
public Module(String pageKey, String topic, String subTopic, ModuleType moduleType, int numPages, String operator, int maxEquationValue)
{
this(pageKey, topic, subTopic, moduleType);
this.numPages = numPages;
System.out.printf("adding rng text: %s\n", pageKey);
GUI_Manager.guiPages.put(pageKey, new TestMathLayout(pageKey, topic, operator, maxEquationValue, numPages));
}
public String getGrade(){
return pageKey.substring(1,2);
}
public String getType(){
return pageKey.substring(2,3);
}
public String getFirstPage(){
if(moduleType == ModuleType.TUTORIAL || moduleType == ModuleType.PRAC_TEST_MULTI){
return pageKey + firstPageIndex;
}
return pageKey;
}
}
enum ModuleType { TUTORIAL, PRAC_TEST_MULTI, PRAC_TEST_RNG, PRAC_TEST_RNG_SHAPE, UNIT_TEST }
//enum ModuleCatagory { TUTORIAL, PRAC_TEST, UNIT_TEST }
//enum Subject { GEOMETRY }