-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProcess.java
61 lines (56 loc) · 3.42 KB
/
Process.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
55
56
57
58
59
60
61
package ProcessScheduler;
/*************************************************************
* Process object class that creates instances of Processes.
*************************************************************/
public class Process{
/* instance variables */
private int priority; // priority of process
private String ID; // ID of process
private String arrivalTime; // arrival time of process
private int burst; // burst time of process
private int age; // age of process
/************************************************************************
* Process constructor. Sets instance variables.
************************************************************************/
public Process(String newID, String arrTime, int burTime, int Pri){
/* set instance variables for new Process */
this.ID = newID;
this.arrivalTime = arrTime;
this.burst = burTime;
this.priority = Pri;
this.age = 0;
}
// getter methods to return process info of choice..
public String getID(){ // method to retrieve the ID of the current process.
return this.ID; // returns the ID of the current Process.
}
public int getPriority(){ // method to retrieve the priority of the current Process.
return this.priority; // returns the priority of the current Process.
}
public String getArrival(){ // method to retrieve the ID of the current Process.
return this.arrivalTime; // returns the ID of the current Process.
}
public int getBurst(){ // method to retrieve the priority of the current Process.
return this.burst; // returns the priority of the current Process.
}
public int getAge(){ // method to retrieve the priority of the current Process.
return this.age; // returns the priority of the current Process.
}
public int getWeight(){ // method to retrieve the priority of the current Process.
return this.burst; // returns the weight of the current Process.
}
// setter methods for altering process info of choice..
public void setPriority(int newPri){ // method to set priority of specified Process. sent var 'newPri'as the new priority.
this.priority = newPri; // sets the specified Process priority as 'newPri'.
}
public void setAge(int newAge){ // method to set priority of specified Process. sent var 'newPri'as the new priority.
this.age = newAge; // sets the specified Process priority as 'newPri'.
}
public void printData(){
/* print all process information to the UI */
UI.textArea.append(" " + this.ID + "\t");
UI.textArea.append(this.arrivalTime + "\t");
UI.textArea.append(this.burst + "\t");
UI.textArea.append(this.priority + "\t\t");
}
}