psdi.webclient.system.controller

Class Counter

  • java.lang.Object
    • psdi.webclient.system.controller.Counter


  • public class Counter
    extends java.lang.Object
    This is a simple object to maintain a count. This is not thread-safe. The count can never be lower than zero. New instances are created with the count starting at one.
    • Constructor Summary

      Constructors 
      Constructor and Description
      Counter() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      int decrement()
      Decrements the count by one, if count is greater than zero, and returns the count.
      int get()
      Returns the count.
      int increment()
      Increments the count by one and returns the count
      void reset()
      Resets the count to 0.
      • Methods inherited from class java.lang.Object

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

      • Counter

        public Counter()
    • Method Detail

      • increment

        public int increment()
        Increments the count by one and returns the count
      • decrement

        public int decrement()
        Decrements the count by one, if count is greater than zero, and returns the count. The count will never be negative
      • get

        public int get()
        Returns the count. The count will never be a negative number
      • reset

        public void reset()
        Resets the count to 0.