Class AbstractProgress

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private long lastLogged
      For logging rate control.
      private int lastValue
      Last logged value.
      private java.util.concurrent.atomic.AtomicInteger processed
      The number of items already processed at a time being.
      protected double ratems
      Last rate.
      private java.lang.String task
      The task name.
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractProgress​(java.lang.String task)
      Default constructor.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.lang.StringBuilder appendToBuffer​(java.lang.StringBuilder buf)
      Serialize a description into a String buffer.
      int getProcessed()
      Get the number of items already processed at a time being.
      java.lang.String getTask()
      Provides the name of the task.
      void incrementProcessed​(Logging logger)
      Increment the processed counter.
      protected void setProcessed​(int processed)
      Sets the number of items already processed at a time being.
      void setProcessed​(int processed, Logging logger)
      Sets the number of items already processed at a time being.
      protected boolean testLoggingRate​(int processed)
      Logging rate control.
      java.lang.String toString()
      Returns a String representation of the progress suitable as a message for printing to the command line interface.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • processed

        private java.util.concurrent.atomic.AtomicInteger processed
        The number of items already processed at a time being. We use AtomicInteger to allow threaded use without synchronization.
      • task

        private java.lang.String task
        The task name.
      • lastLogged

        private long lastLogged
        For logging rate control.
      • lastValue

        private int lastValue
        Last logged value.
      • ratems

        protected double ratems
        Last rate.
    • Constructor Detail

      • AbstractProgress

        public AbstractProgress​(java.lang.String task)
        Default constructor.
        Parameters:
        task - Task name.
    • Method Detail

      • getTask

        public java.lang.String getTask()
        Provides the name of the task.
        Returns:
        the name of the task
      • setProcessed

        protected void setProcessed​(int processed)
                             throws java.lang.IllegalArgumentException
        Sets the number of items already processed at a time being.
        Parameters:
        processed - the number of items already processed at a time being
        Throws:
        java.lang.IllegalArgumentException - if an invalid value was passed.
      • setProcessed

        public void setProcessed​(int processed,
                                 Logging logger)
                          throws java.lang.IllegalArgumentException
        Sets the number of items already processed at a time being.
        Parameters:
        processed - the number of items already processed at a time being
        logger - Logger to report to
        Throws:
        java.lang.IllegalArgumentException - if an invalid value was passed.
      • getProcessed

        public int getProcessed()
        Get the number of items already processed at a time being.
        Returns:
        number of processed items
      • appendToBuffer

        public abstract java.lang.StringBuilder appendToBuffer​(java.lang.StringBuilder buf)
        Serialize a description into a String buffer.
        Specified by:
        appendToBuffer in interface Progress
        Parameters:
        buf - Buffer to serialize to
        Returns:
        Buffer the data was serialized to.
      • toString

        public java.lang.String toString()
        Returns a String representation of the progress suitable as a message for printing to the command line interface.
        Specified by:
        toString in interface Progress
        Overrides:
        toString in class java.lang.Object
        See Also:
        Object.toString()
      • incrementProcessed

        public void incrementProcessed​(Logging logger)
        Increment the processed counter.
        Parameters:
        logger - Logger to report to.
      • testLoggingRate

        protected boolean testLoggingRate​(int processed)
        Logging rate control.
        Parameters:
        processed - Counter
        Returns:
        true when logging is sensible