Package com.complexible.common.base
Class ReportInterval
java.lang.Object
com.complexible.common.base.ReportInterval
- Direct Known Subclasses:
ReportIntervalCounter
A utility class to help with reporting progress at predefined intervals. This class does not keep track of progress
internally but simply
indicates whenever the progress reached or exceeded the report
interval. This class is thread-safe.- Author:
- Evren Sirin
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected longcomputeNextReport(long theValue) Returns the smallest integer greater thantheValuethat is divisable bymInterval.longReturns the elapsed time since this class was created.longReturns the interval for reports.protected longbooleanisReport(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)
-
Constructor Details
-
ReportInterval
public ReportInterval(long theInterval)
-
-
Method Details
-
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.
-