-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoom.java
executable file
·54 lines (42 loc) · 1.14 KB
/
Room.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
package myServer2;
/*
* AUTHOR : Min Gao
* Project1-Multi-Server Chat System
*/
import java.util.ArrayList;
public class Room {
private String roomid;
private ArrayList<String> clientsListInRoom;
private String roomOwner;
private String roomServerid;
public Room(String roomid, String roomOwner, String roomServerid) {
this.roomid = roomid;
this.clientsListInRoom = new ArrayList<>();
this.roomOwner = roomOwner;
this.roomServerid = roomServerid;
}
public Room(String roomid, String roomServerid) {
this.roomid = roomid;
this.clientsListInRoom = new ArrayList<>();
this.roomOwner = "";
this.roomServerid = roomServerid;
}
public String getRoomid() {
return roomid;
}
public String getRoomOwner() {
return roomOwner;
}
public String getRoomServerid() {
return roomServerid;
}
public synchronized ArrayList<String> getClientsListInRoom() {
return clientsListInRoom;
}
public synchronized void addClient(String clientid) {
clientsListInRoom.add(clientid);
}
public synchronized void removeClient(String clientid) {
clientsListInRoom.remove(clientid);
}
}