Class StateBasedPNCounter

    • Field Detail

      • adds

        private long adds
      • removes

        private long removes
    • Constructor Detail

      • StateBasedPNCounter

        protected StateBasedPNCounter()
      • StateBasedPNCounter

        protected StateBasedPNCounter​(long adds,
                                      long removes)
    • Method Detail

      • increment

        public PNCounter increment()
        Description copied from interface: PNCounter
        Increment the counter and get the result.
        Specified by:
        increment in interface GCounter
        Specified by:
        increment in interface PNCounter
        Returns:
        this instance so methods can be chained together; never null
      • decrement

        public PNCounter decrement()
        Description copied from interface: PNCounter
        Decrement the counter and get the result.
        Specified by:
        decrement in interface PNCounter
        Returns:
        this instance so methods can be chained together; never null
      • incrementAndGet

        public long incrementAndGet()
        Description copied from interface: GCounter
        Increment the counter and get the result.
        Specified by:
        incrementAndGet in interface GCounter
        Returns:
        the current result after incrementing
      • decrementAndGet

        public long decrementAndGet()
        Description copied from interface: PNCounter
        Decrement the counter and get the result.
        Specified by:
        decrementAndGet in interface PNCounter
        Returns:
        the current result after decrementing
      • getAndIncrement

        public long getAndIncrement()
        Description copied from interface: GCounter
        Increment the counter and get the result.
        Specified by:
        getAndIncrement in interface GCounter
        Returns:
        the current result before incrementing
      • getAndDecrement

        public long getAndDecrement()
        Description copied from interface: PNCounter
        Decrement the counter and get the result.
        Specified by:
        getAndDecrement in interface PNCounter
        Returns:
        the current result before decrementing
      • get

        public long get()
        Description copied from interface: PNCount
        Get the current value.
        Specified by:
        get in interface Count
        Specified by:
        get in interface PNCount
        Returns:
        the current value
      • getIncrement

        public long getIncrement()
        Description copied from interface: GCount
        Get the amount that the value incremented.
        Specified by:
        getIncrement in interface GCount
        Returns:
        the incremented value
      • merge

        public PNCounter merge​(Count other)
        Description copied from interface: PNCounter
        Merge the supplied counter into this counter.
        Specified by:
        merge in interface GCounter
        Specified by:
        merge in interface PNCounter
        Parameters:
        other - the other counter to merge into this one; may be null
        Returns:
        this counter so that methods can be chained