forked from jieli4970/Algorithm
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcess.java
More file actions
50 lines (37 loc) · 1.05 KB
/
Process.java
File metadata and controls
50 lines (37 loc) · 1.05 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
/**
* 进程数据结构
*/
public class Process {
private String name;
private long totalTime;
private long remainTime;
private long comeInTime;
public Process(String name, long totalTime, long comeInTime) {
this.name = name;
this.totalTime = totalTime;
this.remainTime = totalTime;
this.comeInTime = comeInTime;
}
public void run(long runTime) {
System.out.println("process " + name + " is running...");
System.out.println("come in time : " + comeInTime);
System.out.println("total time : " + totalTime);
System.out.println("remain time : " + remainTime);
System.out.println();
remainTime -= runTime;
try {
Thread.sleep(runTime);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public long getTotalTime() {
return totalTime;
}
public long getRemainTime() {
return remainTime;
}
public long getComeInTime() {
return comeInTime;
}
}