Class Counter


  • public class Counter
    extends Object
    Counts statistics.
    Author:
    madamjak
    • Constructor Detail

      • Counter

        public Counter()
        Default constructor.
    • Method Detail

      • incrementCounter

        public void incrementCounter()
        Increment current counter value.
      • getCounterLastReadValue

        public long getCounterLastReadValue()
        return the last read value of counter. This value can be set during the reading of current counter value, for detail see method getCounterValue(boolean modifyLastReadValue).
        Returns:
        the counterLastReadValue
      • getCounterValue

        public long getCounterValue()
        Gets current value of counter and rewrite CounterLastReadValue by current value.
        Returns:
        the current value of counter
      • getCounterValue

        public long getCounterValue​(boolean modifyLastReadValue)
        Gets current counter value.
        Parameters:
        modifyLastReadValue - true - CounterLastReadValue will be rewritten by current CounterValue false - no change CounterLastReadValue
        Returns:
        the current value of counter
      • reset

        public void reset()
        Sets current counter value and CounterLastReadValue to 0 (zero).
      • getStat

        public String getStat()
        Returns the last and current count for specified statistic.