Class Counter.Wrapper

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable
    Enclosing class:
    Counter

    private static class Counter.Wrapper
    extends Counter
    Base wrapper class for other wrappers.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Counter counter
      The wrapped counter
      private static long serialVersionUID
      The serialVersionUID
    • Constructor Summary

      Constructors 
      Constructor Description
      Wrapper​(Counter counter)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object clone()
      Return a cloned copy of this object.
      int decrement()
      Decrement the counter.
      boolean equals​(java.lang.Object obj)
      Check if the given object is equal to this.
      int getCount()
      Return the current value of the counter.
      int increment()
      Increment the counter.
      void reset()
      Reset the counter to zero.
      java.lang.String toString()
      Return a string representation of this.
      • Methods inherited from class java.lang.Object

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

      • serialVersionUID

        private static final long serialVersionUID
        The serialVersionUID
        See Also:
        Constant Field Values
      • counter

        protected final Counter counter
        The wrapped counter
    • Constructor Detail

      • Wrapper

        public Wrapper​(Counter counter)
    • Method Detail

      • increment

        public int increment()
        Description copied from class: Counter
        Increment the counter. (Optional operation)
        Overrides:
        increment in class Counter
        Returns:
        The incremented value of the counter.
      • decrement

        public int decrement()
        Description copied from class: Counter
        Decrement the counter. (Optional operation)
        Overrides:
        decrement in class Counter
        Returns:
        The decremented value of the counter.
      • getCount

        public int getCount()
        Description copied from class: Counter
        Return the current value of the counter.
        Overrides:
        getCount in class Counter
        Returns:
        The current value of the counter.
      • reset

        public void reset()
        Description copied from class: Counter
        Reset the counter to zero. (Optional operation)
        Overrides:
        reset in class Counter
      • equals

        public boolean equals​(java.lang.Object obj)
        Description copied from class: Counter
        Check if the given object is equal to this.
        Overrides:
        equals in class Counter
        Parameters:
        obj - Object to test equality with.
        Returns:
        True if object is equal to this.
      • toString

        public java.lang.String toString()
        Description copied from class: Counter
        Return a string representation of this.
        Overrides:
        toString in class Counter
        Returns:
        A string representation of this.
      • clone

        public java.lang.Object clone()
        Description copied from class: Counter
        Return a cloned copy of this object.
        Overrides:
        clone in class Counter
        Returns:
        A cloned copy of this object.