de.caff.generics.util

## Interface LongCounter

- All Known Implementing Classes:
    SimpleLongCounter, ThreadSafeLongCounter

      public interface LongCounter

  A long counter is basically a long integer which can be used for counting.

  Depending on the usage it comes in a `thread-safe implementation` and a `non thread-safe implementation`.

  There are also factories for both counters: `SIMPLE` and `THREAD_SAFE`.

  Author:
    Rammi

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static interface` | `LongCounter.Creator` Interface for counter creation.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static LongCounter.Creator` | `SIMPLE` Simple counter creator.
    `static LongCounter.Creator` | `THREAD_SAFE` Thread safe counter creator.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default long` | `add(Counter counter)` Add the value of an integer counter.
    `long` | `add(long add)` Add something to the counter.
    `long` | `add(LongCounter counter)` Add something to the counter.
    `default long` | `add(java.lang.Number number)` Add a number to the counter.
    `long` | `add1()` Add 1 to counter.
    `long` | `getValue()` Get the value.
    `void` | `setValue(long value)` Set the value.
    `default long` | `subtract(Counter counter)` Subtract the value of an integer counter.
    `long` | `subtract(long sub)` Subtract something from the counter.
    `long` | `subtract(LongCounter counter)` Subtract something from the counter.
    `default long` | `subtract(java.lang.Number number)` Subtract a number to the counter.
    `long` | `subtract1()` Subtract 1 from counter.

- - ### Field Detail

    - #### SIMPLE

          static final LongCounter.Creator SIMPLE

      Simple counter creator.
      See Also:
        `SimpleCounter`

    - #### THREAD_SAFE

          static final LongCounter.Creator THREAD_SAFE

      Thread safe counter creator.
      See Also:
        `ThreadSafeCounter`

  - ### Method Detail

    - #### add

          long add(long add)

      Add something to the counter.
      Parameters:
        `add` - value to add
      Returns:
        counter value

    - #### add

          long add(@NotNull
                   LongCounter counter)

      Add something to the counter.
      Parameters:
        `counter` - counter which value is added
      Returns:
        counter value

    - #### add

          default long add(@NotNull
                           java.lang.Number number)

      Add a number to the counter.
      Parameters:
        `number` - number to add, treated as a long value
      Returns:
        new counter value

    - #### add

          default long add(@NotNull
                           Counter counter)

      Add the value of an integer counter.
      Parameters:
        `counter` - integer counter
      Returns:
        new counter value

    - #### add1

          long add1()

      Add 1 to counter.
      Returns:
        counter value

    - #### subtract

          long subtract(long sub)

      Subtract something from the counter.
      Parameters:
        `sub` - value to subtract
      Returns:
        counter value

    - #### subtract

          long subtract(@NotNull
                        LongCounter counter)

      Subtract something from the counter.
      Parameters:
        `counter` - counter which value is subtracted
      Returns:
        counter value

    - #### subtract

          default long subtract(@NotNull
                                java.lang.Number number)

      Subtract a number to the counter.
      Parameters:
        `number` - number to add, treated as a long value
      Returns:
        new counter value

    - #### subtract

          default long subtract(@NotNull
                                Counter counter)

      Subtract the value of an integer counter.
      Parameters:
        `counter` - integer counter
      Returns:
        new counter value

    - #### subtract1

          long subtract1()

      Subtract 1 from counter.
      Returns:
        counter value

    - #### getValue

          long getValue()

      Get the value.
      Returns:
        accumulated value

    - #### setValue

          void setValue(long value)

      Set the value.
      Parameters:
        `value` - new value