Clover Coverage Report - Atlassian Core
Coverage timestamp: Sun Nov 30 2008 18:33:35 CST
20   98   16   1.67
6   71   0.8   12
12     1.33  
1    
 
 
  ProgressMeter       Line # 9 20 16 5.3% 0.05263158
 
  (1)
 
1    /*
2    * Created by IntelliJ IDEA.
3    * User: Mike
4    * Date: Mar 5, 2004
5    * Time: 12:57:20 PM
6    */
7    package com.atlassian.core.util;
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    * Use this method to set the completion %age to object 10 of 30 etc.
19    *
20    * @param count The current object count in progress
21    * @param total The total number of objects to be processed
22    */
 
23  0 toggle 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   
 
42  2 toggle public void setStatus(String status)
43    {
44  2 this.status = status;
45    }
46   
 
47  0 toggle public int getPercentageComplete()
48    {
49  0 return percentageComplete;
50    }
51   
 
52  0 toggle public String getStatus()
53    {
54  0 return status;
55    }
56   
 
57  0 toggle public void setPercentage(int percentageComplete)
58    {
59  0 this.percentageComplete = percentageComplete;
60    }
61   
 
62  0 toggle public int getCurrentCount()
63    {
64  0 return currentCount;
65    }
66   
 
67  0 toggle public void setCurrentCount(int currentCount)
68    {
69  0 this.currentCount = currentCount;
70  0 updatePercentageComplete();
71    }
72   
 
73  0 toggle private void updatePercentageComplete()
74    {
75  0 setPercentage(getCurrentCount(),getTotal());
76    }
77   
 
78  0 toggle public int getTotal()
79    {
80  0 return total;
81    }
82   
 
83  0 toggle public void setTotalObjects(int total)
84    {
85  0 this.total = total;
86  0 updatePercentageComplete();
87    }
88   
 
89  0 toggle public boolean isCompletedSuccessfully()
90    {
91  0 return completedSuccessfully;
92    }
93   
 
94  0 toggle public void setCompletedSuccessfully(boolean completedSuccessfully)
95    {
96  0 this.completedSuccessfully = completedSuccessfully;
97    }
98    }