public class

EstimatedProgressMeter

extends Object
java.lang.Object
   ↳ com.atlassian.confluence.util.EstimatedProgressMeter

Class Overview

A progress meter to be used in situations where the total cannot be determined efficiently or conveniently up front. Instead, this progress meter will take an estimate for the total and never increment the progress past 99%, unless specifically told to.

Summary

Public Constructors
EstimatedProgressMeter(int estimatedTotal)
Public Methods
synchronized void complete()
Sets the percent complete of this progress meter to 100%, regardless of where the progress is currently up to.
synchronized int getCount()
synchronized int getEstimatedTotal()
synchronized int getPercentageComplete()
synchronized int incrementCount()
Increases the current count or progress by one.
synchronized void setEstimatedTotal(int estimatedTotal)
Sets the estimatedTotal.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public EstimatedProgressMeter (int estimatedTotal)

Parameters
estimatedTotal the estimated total
Throws
IllegalArgumentException if estimatedTotal is less than zero.

Public Methods

public synchronized void complete ()

Sets the percent complete of this progress meter to 100%, regardless of where the progress is currently up to.

public synchronized int getCount ()

Returns
  • the current count. It is possible for the count to exceed the estimated total.

public synchronized int getEstimatedTotal ()

Returns
  • the estimated total

public synchronized int getPercentageComplete ()

Returns
  • the current percentage complete

public synchronized int incrementCount ()

Increases the current count or progress by one. Returns the current count after the update.

public synchronized void setEstimatedTotal (int estimatedTotal)

Sets the estimatedTotal. This method is useful when the estimatedTotal is not available at construction time. Note: this method can only be used when the count has not been incremented.

Parameters
estimatedTotal the estimated total
Throws
IllegalArgumentException if estimatedTotal is less than zero.
IllegalStateException if this is called after progress has started (that is, incrementCount() has been called at least once)