| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
package com.atlassian.core.util; |
| 8 |
|
|
|
|
|
| 5.3% |
Uncovered Elements: 36 (38) |
Complexity: 16 |
Complexity Density: 0.8 |
|
| 9 |
|
public class ProgressMeter |
| 10 |
|
{ |
| 11 |
|
int percentageComplete; |
| 12 |
|
private String status; |
| 13 |
|
private int total; |
| 14 |
|
private int currentCount; |
| 15 |
|
private boolean completedSuccessfully = true; |
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
@param |
| 21 |
|
@param |
| 22 |
|
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 5 |
Complexity Density: 0.71 |
|
| 23 |
0
|
public void setPercentage(int count, int total)... |
| 24 |
|
{ |
| 25 |
0
|
if (total < 0) |
| 26 |
|
{ |
| 27 |
0
|
percentageComplete = 0; |
| 28 |
|
} |
| 29 |
0
|
else if (total <= count) |
| 30 |
|
{ |
| 31 |
0
|
percentageComplete = 100; |
| 32 |
|
} |
| 33 |
|
else |
| 34 |
|
{ |
| 35 |
0
|
percentageComplete = ((int) (100 * (float) count / (float) total)); |
| 36 |
|
|
| 37 |
0
|
if (count < total && percentageComplete == 100) |
| 38 |
0
|
percentageComplete = 99; |
| 39 |
|
} |
| 40 |
|
} |
| 41 |
|
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 42 |
2
|
public void setStatus(String status)... |
| 43 |
|
{ |
| 44 |
2
|
this.status = status; |
| 45 |
|
} |
| 46 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 47 |
0
|
public int getPercentageComplete()... |
| 48 |
|
{ |
| 49 |
0
|
return percentageComplete; |
| 50 |
|
} |
| 51 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 52 |
0
|
public String getStatus()... |
| 53 |
|
{ |
| 54 |
0
|
return status; |
| 55 |
|
} |
| 56 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 57 |
0
|
public void setPercentage(int percentageComplete)... |
| 58 |
|
{ |
| 59 |
0
|
this.percentageComplete = percentageComplete; |
| 60 |
|
} |
| 61 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 62 |
0
|
public int getCurrentCount()... |
| 63 |
|
{ |
| 64 |
0
|
return currentCount; |
| 65 |
|
} |
| 66 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 67 |
0
|
public void setCurrentCount(int currentCount)... |
| 68 |
|
{ |
| 69 |
0
|
this.currentCount = currentCount; |
| 70 |
0
|
updatePercentageComplete(); |
| 71 |
|
} |
| 72 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 73 |
0
|
private void updatePercentageComplete()... |
| 74 |
|
{ |
| 75 |
0
|
setPercentage(getCurrentCount(),getTotal()); |
| 76 |
|
} |
| 77 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 78 |
0
|
public int getTotal()... |
| 79 |
|
{ |
| 80 |
0
|
return total; |
| 81 |
|
} |
| 82 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 83 |
0
|
public void setTotalObjects(int total)... |
| 84 |
|
{ |
| 85 |
0
|
this.total = total; |
| 86 |
0
|
updatePercentageComplete(); |
| 87 |
|
} |
| 88 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 89 |
0
|
public boolean isCompletedSuccessfully()... |
| 90 |
|
{ |
| 91 |
0
|
return completedSuccessfully; |
| 92 |
|
} |
| 93 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 94 |
0
|
public void setCompletedSuccessfully(boolean completedSuccessfully)... |
| 95 |
|
{ |
| 96 |
0
|
this.completedSuccessfully = completedSuccessfully; |
| 97 |
|
} |
| 98 |
|
} |