Coverage Report - org.kuali.maven.wagon.PercentCompleteTracker
 
Classes in this File Line Coverage Branch Coverage Complexity
PercentCompleteTracker
0%
0/12
0%
0/4
1.25
 
 1  
 package org.kuali.maven.wagon;
 2  
 
 3  
 /**
 4  
  * Print a dot whenever there is progress of 2% or more
 5  
  */
 6  0
 public class PercentCompleteTracker extends ProgressTracker {
 7  0
     int percentageIncrement = 2;
 8  
     int percentCompletePrevious;
 9  
 
 10  
     @Override
 11  
     protected void showProgress(int count, int total) {
 12  0
         int percentComplete = (count * 100) / total;
 13  0
         if (enoughProgress(percentComplete)) {
 14  0
             percentCompletePrevious = percentComplete;
 15  0
             out.print(progressToken);
 16  
         }
 17  0
     }
 18  
 
 19  
     protected boolean enoughProgress(int percentComplete) {
 20  0
         int needed = percentCompletePrevious + percentageIncrement;
 21  0
         return percentComplete >= needed;
 22  
     }
 23  
 
 24  
     public int getPercentageIncrement() {
 25  0
         return percentageIncrement;
 26  
     }
 27  
 
 28  
     public void setPercentageIncrement(int percentageIncrement) {
 29  0
         this.percentageIncrement = percentageIncrement;
 30  0
     }
 31  
 
 32  
 }