~peter-gjoel/smcscheduling/TaskIntegrity

« back to all changes in this revision

Viewing changes to src/model/Task.java

  • Committer: Peter Gjøl Jensen
  • Date: 2013-05-20 21:06:18 UTC
  • Revision ID: peter.gjoel@gmail.com-20130520210618-elok94jyxz1o97oj
runcheck

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
import java.util.ArrayList;
4
4
 
5
5
import org.apache.commons.lang3.builder.HashCodeBuilder;
 
6
import scheduler.Main;
6
7
 
7
8
public class Task {
8
9
        private ArrayList<ResourceUsage> usedResources;
9
10
        private double minTimeToRun;
10
11
        private double maxTimeToRun;
11
12
        private Process parentProcess;
12
 
        private int id;
 
13
        private int id = -1;
13
14
        
14
15
        @Override
15
16
        protected Task clone() throws CloneNotSupportedException {
24
25
                this.minTimeToRun = minTimeToRun;
25
26
                this.maxTimeToRun = maxTimeToRun;
26
27
        }
 
28
        
 
29
        public Task(double beginTime, double endTime){
 
30
                maxTimeToRun = minTimeToRun = endTime - beginTime;
 
31
        }
27
32
        
 
33
        public Task getRealTask(){
 
34
            return  Main.processes.getProcess(this.getParentProcess().getProcessID()).getTask(this.getId());
 
35
        }
 
36
        
 
37
        public boolean CheckTaskIntegrity(){
 
38
            Task realTask = getRealTask();
 
39
            return realTask.getMaxTimeToRun() >= maxTimeToRun;
 
40
        }
 
41
        
28
42
        protected void setParentProcess(Process parentProcess) {
29
43
                this.parentProcess = parentProcess;
30
44
        }