-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvCreate.java
94 lines (77 loc) · 3.03 KB
/
vCreate.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
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Set;
public class vCreate {
HashMap<String,ArrayList<String>> vVariables = new HashMap<String,ArrayList<String>>();
HashMap<String,ArrayList<String>> vMethods = new HashMap<String,ArrayList<String>>();
HashMap<String,ArrayList<String>> VariablesSorted;
HashMap<String,ArrayList<String>> MethodsSorted;
HashMap<String,String> ClassMap;
String currentClass;
HashMap<String,String> insertedMethods;
public vCreate(HashMap<String,ArrayList<String>> VariablesSorted, HashMap<String,ArrayList<String>> MethodsSorted, HashMap<String,String> ClassMap) {
this.VariablesSorted = VariablesSorted;
this.MethodsSorted = MethodsSorted;
this.ClassMap = ClassMap;
}
public HashMap<String,ArrayList<String>> getvVariables() {
return vVariables;
}
public HashMap<String,ArrayList<String>> getvMethods() {
return vMethods;
}
public void CreateVariablesTable() {
Set<String> classes = ClassMap.keySet();
for (String temp : classes) {
if (ClassMap.get(temp) != null && ClassMap.get(temp).equals("-main-")) {
classes.remove(temp);
break;
}
}
for (String clss : classes) {
currentClass = clss;
insertedMethods = new HashMap<String,String>();
vVariables.put(clss, new ArrayList<String>());
vMethods.put(clss, new ArrayList<String>());
fillVariables(clss);
fillMethods(clss);
}
// for (String temp2 : vVariables.get("B")) {
// System.out.println(temp2);
// }
//
// for (String temp3 : vMethods.get("B")) {
// System.out.println(temp3);
// }
}
public void fillVariables(String className) {
if (this.ClassMap.get(className) != null) {
fillVariables(this.ClassMap.get(className));
}
ArrayList<String> tempVars = new ArrayList<String>();
for (String temp : VariablesSorted.get(className)) {
tempVars.add(className + "_" + temp);
}
vVariables.get(currentClass).addAll(tempVars);
}
public void fillMethods(String className) {
if (this.ClassMap.get(className) != null) {
fillMethods(this.ClassMap.get(className));
}
int listIndex;
String inheritClass;
ArrayList<String> tempMethods = new ArrayList<String>();
for (String temp : MethodsSorted.get(className)) {
if ((inheritClass = insertedMethods.get(temp)) != null) {
listIndex = vMethods.get(currentClass).indexOf(inheritClass + "_" + temp);
vMethods.get(currentClass).set(listIndex,className + "_" + temp);
insertedMethods.put(temp,className);
}
else {
tempMethods.add(className + "_" + temp);
insertedMethods.put(temp,className);
}
}
vMethods.get(currentClass).addAll(tempMethods);
}
}