[883] | 1 | package schedframe.scheduling.tasks.phases; |
---|
| 2 | |
---|
[896] | 3 | import java.util.LinkedList; |
---|
[883] | 4 | |
---|
[1362] | 5 | public class ExecutionProfile { |
---|
[883] | 6 | |
---|
[1423] | 7 | protected LinkedList<ExecutionPhase> executionPhases; |
---|
[1207] | 8 | protected long usefulWork; |
---|
[1415] | 9 | protected double completionPercentage; |
---|
[1207] | 10 | private int currentPhase; |
---|
[1415] | 11 | |
---|
[1362] | 12 | |
---|
[1423] | 13 | public ExecutionProfile(LinkedList<ExecutionPhase> execPhases) { |
---|
| 14 | this.executionPhases = execPhases; |
---|
[1415] | 15 | this.completionPercentage = 0; |
---|
[1362] | 16 | this.currentPhase = 0; |
---|
[883] | 17 | } |
---|
[896] | 18 | |
---|
[1423] | 19 | public LinkedList<ExecutionPhase> getExecutionPhases(){ |
---|
| 20 | return executionPhases; |
---|
[896] | 21 | } |
---|
| 22 | |
---|
[1423] | 23 | public ExecutionPhase getCurrentExecutionPhase(){ |
---|
| 24 | return executionPhases.get(currentPhase); |
---|
[896] | 25 | } |
---|
| 26 | |
---|
| 27 | public int getCurrentPhase() { |
---|
| 28 | return currentPhase; |
---|
| 29 | } |
---|
| 30 | |
---|
| 31 | public void setCurrentPhase(int currentPhase) { |
---|
| 32 | this.currentPhase = currentPhase; |
---|
| 33 | } |
---|
[1207] | 34 | |
---|
| 35 | public long getUsefulWork() { |
---|
| 36 | return usefulWork; |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | public void setUsefulWork(long usefulWork) { |
---|
| 40 | this.usefulWork = usefulWork; |
---|
| 41 | } |
---|
[1362] | 42 | |
---|
| 43 | public boolean isLast(){ |
---|
[1423] | 44 | if(currentPhase == executionPhases.size() - 1){ |
---|
[1362] | 45 | return true; |
---|
| 46 | } |
---|
| 47 | return false; |
---|
| 48 | } |
---|
[1415] | 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; |
---|
[1423] | 60 | for(ExecutionPhase execPhase: executionPhases){ |
---|
[1415] | 61 | length = length + execPhase.getLenght(); |
---|
| 62 | } |
---|
| 63 | return length; |
---|
| 64 | } |
---|
[883] | 65 | } |
---|