-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDataModular.java
More file actions
120 lines (90 loc) · 3.04 KB
/
DataModular.java
File metadata and controls
120 lines (90 loc) · 3.04 KB
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package edu.cmu.qatar.cs214.hw.hw4;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
public class DataModular {
private List<DataPlugin> dataPlugin;
public DataModular(List<DataPlugin> dataPlugin) {
this.dataPlugin = dataPlugin;
}
/**
* @param userID
* id for which to get the activity
* @return D where D is the dates userID was active at
*/
public HashMap<String, ArrayList<Date>> getUserActivity(String userID) {
HashMap<String, ArrayList<Date>> hashResult = new HashMap<String, ArrayList<Date>>();
for (int i = 0; i < dataPlugin.size(); i++) {
hashResult.put(this.dataPlugin.get(i).getSource(), this.dataPlugin
.get(i).getUserActivity(userID));
}
return hashResult;
}
/**
* @param userID
* the id for which to get all the firends
* @return all the friends
*/
public HashMap<String, ArrayList<String>> getUserFriends(String userID) {
HashMap<String, ArrayList<String>> hashResult = new HashMap<String, ArrayList<String>>();
for (int i = 0; i < dataPlugin.size(); i++) {
hashResult.put(this.dataPlugin.get(i).getSource(), this.dataPlugin
.get(i).getUserFriends(userID));
}
return hashResult;
}
/**
* @param userID
* the id for which to get the personal info
* @return the personal info
*/
public HashMap<String, ArrayList<String>> getPersonalInfo(String userID) {
HashMap<String, ArrayList<String>> hashResult = new HashMap<String, ArrayList<String>>();
for (int i = 0; i < dataPlugin.size(); i++) {
hashResult.put(this.dataPlugin.get(i).getSource(), this.dataPlugin
.get(i).getPersonalInfo(userID));
}
return hashResult;
}
/**
* @param userID
* the id for which to get all the recom friends
* @return the recommended friends
*/
public HashMap<String, ArrayList<String>> getRecommendedFriends(
String userID) {
HashMap<String, ArrayList<String>> hashResult = new HashMap<String, ArrayList<String>>();
for (int i = 0; i < dataPlugin.size(); i++) {
hashResult.put(this.dataPlugin.get(i).getSource(), this.dataPlugin
.get(i).getRecommendedFriends(userID));
}
return hashResult;
}
/**
* @param userID
* the id for which to get the number of friends
* @return the number of friends
*/
public HashMap<String, Integer> getNumberFriends(String userID) {
HashMap<String, Integer> hashResult = new HashMap<String, Integer>();
for (int i = 0; i < dataPlugin.size(); i++) {
hashResult.put(this.dataPlugin.get(i).getSource(), this.dataPlugin
.get(i).getNumberFriends(userID));
}
return hashResult;
}
/**
* @param userID
* the id for which to get the status
* @return the status
*/
public HashMap<String, ArrayList<String>> getStatus(String userID) {
HashMap<String, ArrayList<String>> hashResult = new HashMap<String, ArrayList<String>>();
for (int i = 0; i < dataPlugin.size(); i++) {
hashResult.put(this.dataPlugin.get(i).getSource(), this.dataPlugin
.get(i).getStatus(userID));
}
return hashResult;
}
}