Package com.complexible.common.base
Class ReportInterval
- java.lang.Object
-
- com.complexible.common.base.ReportInterval
-
- Direct Known Subclasses:
ReportIntervalCounter
public class ReportInterval extends java.lang.Object
A utility class to help with reporting progress at predefined intervals. This class does not keep track of progress internally but simplyindicates
whenever the progress reached or exceeded the report interval. This class is thread-safe.- Author:
- Evren Sirin
-
-
Constructor Summary
Constructors Constructor Description ReportInterval(long theInterval)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected long
computeNextReport(long theValue)
Returns the smallest integer greater thantheValue
that is divisable bymInterval
.long
getElapsedTime()
Returns the elapsed time since this class was created.long
getInterval()
Returns the interval for reports.protected long
getNextReport()
boolean
isReport(long theValue)
Returnstrue
if the given progress value reached or exceeded the next report value and if so updates the next report value to be greater thantheValue
by.void
setInterval(long theInterval)
-
-
-
Method Detail
-
getInterval
public long getInterval()
Returns the interval for reports.
-
setInterval
public void setInterval(long theInterval)
-
getNextReport
protected long getNextReport()
-
isReport
public boolean isReport(long theValue)
Returnstrue
if the given progress value reached or exceeded the next report value and if so updates the next report value to be greater thantheValue
by.
-
computeNextReport
protected long computeNextReport(long theValue)
Returns the smallest integer greater thantheValue
that is divisable bymInterval
.
-
getElapsedTime
public long getElapsedTime()
Returns the elapsed time since this class was created. This is not used for reporting and provided here only for convenience.
-
-