-
Notifications
You must be signed in to change notification settings - Fork 0
/
Player.java
54 lines (37 loc) · 844 Bytes
/
Player.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
import java.util.Date;
public class Player extends Thread{
int ID;
int WaitingTime;
boolean OnBoard=false;
boolean RideCompleted=false;
Operator op;
public Player(int WaitingTime ,Operator O,int ID){
this.WaitingTime=WaitingTime;
this.op=O;
this.ID=ID;
}
public void run(){
try {
this.sleep(WaitingTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println("player wakes up:"+this.getID());
op.pleaseQueueMeInTheWheel(this);
}
public void setRideCompleted(boolean rideComplete) {
RideCompleted = rideComplete;
}
public void setOnBoard(boolean onBoard) {
OnBoard = onBoard;
}
public int getID() {
return ID;
}
public boolean isRideCompleted() {
return RideCompleted;
}
public boolean isOnBoard() {
return OnBoard;
}
}