Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package SO1;
- public class Process implements Comparable<Process>, Cloneable
- {
- private int _time;
- final int ID;
- private int _wholeProcessTime;
- private int _addTime =0;
- private int _endTime =0;
- private boolean _done = false;
- public Process(int t, int id)
- {
- _time = t;
- _wholeProcessTime = t;
- ID = id;
- }
- public void executePart()
- {
- _time--;
- }
- public void set_endTime(int t)
- {
- _endTime = t;
- }
- public void set_addTime(int t)
- {
- _addTime = t;
- }
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
- public int compareTo(Process process)
- {
- if(_time>process._time)
- return 1;
- else if(_time==process._time)
- return 0;
- else
- return -1;
- }
- @Override
- public String toString()
- {
- return "id :" + ID + " Time: " + _wholeProcessTime + " wait :" + getWaitingTime(); //" Add Time " + _addTime +
- }
- public boolean idDone()
- {
- return _done;
- }
- public void markAsDone()
- {
- _done = true;
- }
- public int getWaitingTime()
- {
- return _endTime-_addTime-_wholeProcessTime;
- }
- public int getTime()
- {
- return _time;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement