-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSlot.java
More file actions
62 lines (48 loc) · 1.37 KB
/
Slot.java
File metadata and controls
62 lines (48 loc) · 1.37 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
public class Slot {
int owner;
int status;
int processTimeLeft;
public static final int STATUS_FREE = 0;
public static final int STATUS_USED = 1;
public static final int STATUS_DONATING = 2;
public static final int STATUS_UNINIT = 3;
public Slot(int owner, int status, int timeLeft) {
this.owner = owner;
this.status = status;
this.processTimeLeft = timeLeft;
}
public Slot() {
this.owner = 0;
this.status = STATUS_UNINIT;
this.processTimeLeft = -1;
}
public Slot(Slot originalSlot) {
this.owner = originalSlot.getOwner();
this.status = originalSlot.getStatus();
this.processTimeLeft = originalSlot.getProcessTimeLeft();
}
public boolean isFree() {
return (this.status == STATUS_FREE);
}
public boolean isUsed() {
return (this.status == STATUS_USED);
}
public int getOwner() {
return owner;
}
public void setOwner(int owner) {
this.owner = owner;
}
public void setProcessLifetime(int timeUnits) {
this.processTimeLeft = timeUnits;
}
public int getStatus() {
return status;
}
public int getProcessTimeLeft() {
return processTimeLeft;
}
public void setStatus(int status) {
this.status = status;
}
}