Class 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 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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected long computeNextReport​(long theValue)
      Returns the smallest integer greater than theValue that is divisable by mInterval.
      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)
      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 Detail

      • ReportInterval

        public ReportInterval​(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)
        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.