-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUserGroup.java
More file actions
56 lines (46 loc) · 1.23 KB
/
UserGroup.java
File metadata and controls
56 lines (46 loc) · 1.23 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
import java.util.ArrayList;
import java.util.List;
public class UserGroup implements Component{
private String groupID;
private List<Component> components;
private long creationTime;
// usergroup constructor
public UserGroup(String groupID){
this.creationTime = System.currentTimeMillis();
this.groupID = groupID;
this.components = new ArrayList<>();
this.creationTime = System.currentTimeMillis() - this.creationTime;
}
// get creation time
public long getCreationTime(){
return this.creationTime;
}
// get the components
public List<Component> getComponents(){
return this.components;
}
// accept a visitor for data
public void acceptVisitor(Visitor visitor){
visitor.visit(this);
}
// get group id
@Override
public String getID(){
return this.groupID;
}
// add a user
@Override
public void addUser(Component component){
components.add(component);
}
// remove a user
@Override
public void removeUser(Component component){
components.remove(component);
}
// print user group
@Override
public String toString(){
return getID();
}
}