Class ReportInterval

java.lang.Object
com.complexible.common.base.ReportInterval
Direct Known Subclasses:
ReportIntervalCounter

public class ReportInterval extends Object
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
    Constructor
    Description
    ReportInterval(long theInterval)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected long
    computeNextReport(long theValue)
    Returns the smallest integer greater than theValue that is divisable by mInterval.
    long
    Returns the elapsed time since this class was created.
    long
    Returns the interval for reports.
    protected long
     
    boolean
    isReport(long theValue)
    Returns true if the given progress value reached or exceeded the next report value and if so updates the next report value to be greater than theValueby.
    void
    setInterval(long theInterval)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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)
      Returns true if the given progress value reached or exceeded the next report value and if so updates the next report value to be greater than theValueby.
    • computeNextReport

      protected long computeNextReport(long theValue)
      Returns the smallest integer greater than theValue that is divisable by mInterval.
    • 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.