1 | package schedframe.scheduling.tasks.phases; |
---|
2 | |
---|
3 | import java.util.LinkedList; |
---|
4 | |
---|
5 | public class ExecutionProfile { |
---|
6 | |
---|
7 | protected LinkedList<ExecutionPhase> resourceConsumptionList; |
---|
8 | protected long usefulWork; |
---|
9 | protected double completionPercentage; |
---|
10 | private int currentPhase; |
---|
11 | |
---|
12 | |
---|
13 | public ExecutionProfile(LinkedList<ExecutionPhase> resourceConsumptionList) { |
---|
14 | this.resourceConsumptionList = resourceConsumptionList; |
---|
15 | this.completionPercentage = 0; |
---|
16 | this.currentPhase = 0; |
---|
17 | } |
---|
18 | |
---|
19 | public LinkedList<ExecutionPhase> getResourceConsumptionList(){ |
---|
20 | return resourceConsumptionList; |
---|
21 | } |
---|
22 | |
---|
23 | public ExecutionPhase getCurrentResourceConsumption(){ |
---|
24 | return resourceConsumptionList.get(currentPhase); |
---|
25 | } |
---|
26 | |
---|
27 | public int getCurrentPhase() { |
---|
28 | return currentPhase; |
---|
29 | } |
---|
30 | |
---|
31 | public void setCurrentPhase(int currentPhase) { |
---|
32 | this.currentPhase = currentPhase; |
---|
33 | } |
---|
34 | |
---|
35 | public long getUsefulWork() { |
---|
36 | return usefulWork; |
---|
37 | } |
---|
38 | |
---|
39 | public void setUsefulWork(long usefulWork) { |
---|
40 | this.usefulWork = usefulWork; |
---|
41 | } |
---|
42 | |
---|
43 | public boolean isLast(){ |
---|
44 | if(currentPhase == resourceConsumptionList.size() - 1){ |
---|
45 | return true; |
---|
46 | } |
---|
47 | return false; |
---|
48 | } |
---|
49 | |
---|
50 | public double getCompletionPercentage() { |
---|
51 | return completionPercentage; |
---|
52 | } |
---|
53 | |
---|
54 | public void setCompletionPercentage(double completionPercentage) { |
---|
55 | this.completionPercentage = completionPercentage; |
---|
56 | } |
---|
57 | |
---|
58 | public long getLength() { |
---|
59 | long length = 0; |
---|
60 | for(ExecutionPhase execPhase: resourceConsumptionList){ |
---|
61 | length = length + execPhase.getLenght(); |
---|
62 | } |
---|
63 | return length; |
---|
64 | } |
---|
65 | } |
---|