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.ObjectA utility class to help with reporting progress at predefined intervals. This class does not keep track of progress internally but simplyindicateswhenever 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 longcomputeNextReport(long theValue)Returns the smallest integer greater thantheValuethat is divisable bymInterval.longgetElapsedTime()Returns the elapsed time since this class was created.longgetInterval()Returns the interval for reports.protected longgetNextReport()booleanisReport(long theValue)Returnstrueif the given progress value reached or exceeded the next report value and if so updates the next report value to be greater thantheValueby.voidsetInterval(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)
Returnstrueif the given progress value reached or exceeded the next report value and if so updates the next report value to be greater thantheValueby.
-
computeNextReport
protected long computeNextReport(long theValue)
Returns the smallest integer greater thantheValuethat 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.
-
-