Class CounterStatistic


  • public class CounterStatistic
    extends java.lang.Object

    Statistics on a counter value.

    This class keeps the total, current and maximum value of a counter that can be incremented and decremented. The total refers only to increments.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      long add​(long delta)  
      long decrement()
      Decrements the value by one.
      long getCurrent()  
      long getMax()  
      long getTotal()  
      long increment()
      Increments the value by one.
      void reset()
      Resets the max and total to the current value.
      void reset​(long value)
      Resets the max, total and current value to the given parameter.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

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

      • CounterStatistic

        public CounterStatistic()
    • Method Detail

      • reset

        public void reset()
        Resets the max and total to the current value.
      • reset

        public void reset​(long value)
        Resets the max, total and current value to the given parameter.
        Parameters:
        value - the new current value
      • add

        public long add​(long delta)
        Parameters:
        delta - the amount to add to the counter
        Returns:
        the new counter value
      • increment

        public long increment()
        Increments the value by one.
        Returns:
        the new counter value after the increment
      • decrement

        public long decrement()
        Decrements the value by one.
        Returns:
        the new counter value after the decrement
      • getMax

        public long getMax()
        Returns:
        max counter value
      • getCurrent

        public long getCurrent()
        Returns:
        current counter value
      • getTotal

        public long getTotal()
        Returns:
        total counter value
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object