-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathScheduler.java
More file actions
61 lines (48 loc) · 1.34 KB
/
Scheduler.java
File metadata and controls
61 lines (48 loc) · 1.34 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
package schedulermanager;
import static java.lang.String.format;
import java.util.List;
/**
*
* @author Nycholas de Sousa
* @matricula 11228201
*
*/
public class Scheduler {
private double avgReturn;
private double avgResponse;
private double avgWait;
public double getAvgReturn() {
return avgReturn;
}
public void setAvgReturn(double avgReturn) {
this.avgReturn = avgReturn;
}
public double getAvgResponse() {
return avgResponse;
}
public void setAvgResponse(double avgResponse) {
this.avgResponse = avgResponse;
}
public double getAvgWait() {
return avgWait;
}
public void setAvgWait(double avgWait) {
this.avgWait = avgWait;
}
public int arrivalMin(List<Process> process) {
int min = process.get(0).getArrivalTime();
for (Process p : process) {
if (p.getArrivalTime() < min) {
min = p.getArrivalTime();
}
}
return min;
}
public int getAmountOfProcess(List<Process> process) {
return process.size();
}
public void print(String schedulerType) {
System.out.println(format("%s %.1f %.1f %.1f", schedulerType, getAvgReturn(),
getAvgResponse(), getAvgWait()));
}
}