Class BasicCounter

    • Constructor Detail

      • BasicCounter

        public BasicCounter()
        Creates a counter with an initial count of 0. Prior to calling increment() for the first time, start() must be called.
    • Method Detail

      • stop

        public void stop()
        Places the counter in the stopped state. This method can be called while in any state and thus is safe to call within a finally block.
      • increment

        public void increment()
        Increments the counter by 1
      • increment

        public void increment​(long stepSize)
        Increments the counter by the specified step size
        Parameters:
        stepSize - the amount by which to increment
      • getCount

        public long getCount()
        Description copied from interface: CounterSupplier
        This will return the value of the counter or an undefined value if never started.
        Specified by:
        getCount in interface CounterSupplier
        Returns:
        the value of the counter or an undefined value if never started.