Packages

abstract class AtomicNumber[A] extends Atomic[A]

Represents an Atomic reference holding a number, providing helpers for easily incrementing and decrementing it.

A

should be something that's Numeric

Source
AtomicNumber.scala
Linear Supertypes
Atomic[A], Serializable, AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. AtomicNumber
  2. Atomic
  3. Serializable
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new AtomicNumber()

Abstract Value Members

  1. abstract def add(v: A): Unit

    Adds to the atomic number the given value.

  2. abstract def addAndGet(v: A): A

    Adds to the atomic number and returns the result.

  3. abstract def compareAndSet(expect: A, update: A): Boolean

    Does a compare-and-set operation on the current value.

    Does a compare-and-set operation on the current value. For more info, checkout the related Compare-and-swap Wikipedia page.

    It's an atomic, worry free operation.

    expect

    is the value you expect to be persisted when the operation happens

    update

    will be the new value, should the check for expect succeeds

    returns

    either true in case the operation succeeded or false otherwise

    Definition Classes
    Atomic
  4. abstract def decrement(v: Int = 1): Unit

    Decrements the atomic number with the given integer.

  5. abstract def decrementAndGet(v: Int = 1): A

    Decrements the atomic number and returns the result.

  6. abstract def get(): A

    Get the current value persisted by this Atomic.

    Get the current value persisted by this Atomic.

    Definition Classes
    Atomic
  7. abstract def getAndAdd(v: A): A

    Adds to the the atomic number and returns the value before the update.

  8. abstract def getAndDecrement(v: Int = 1): A

    Decrements the atomic number and returns the value before the update.

  9. abstract def getAndIncrement(v: Int = 1): A

    Increments the atomic number and returns the value before the update.

  10. abstract def getAndSet(update: A): A

    Sets the persisted value to update and returns the old value that was in place.

    Sets the persisted value to update and returns the old value that was in place. It's an atomic, worry free operation.

    Definition Classes
    Atomic
  11. abstract def getAndSubtract(v: A): A

    Subtracts from the atomic number and returns the value before the update.

  12. abstract def increment(v: Int = 1): Unit

    Increment with the given integer

  13. abstract def incrementAndGet(v: Int = 1): A

    Increments the atomic number and returns the result.

  14. abstract def lazySet(update: A): Unit

    Eventually sets to the given value.

    Eventually sets to the given value. Has weaker visibility guarantees than the normal set().

    Definition Classes
    Atomic
  15. abstract def set(update: A): Unit

    Updates the current value.

    Updates the current value.

    update

    will be the new value returned by get()

    Definition Classes
    Atomic
  16. abstract def subtract(v: A): Unit

    Subtracts from the atomic number the given value.

  17. abstract def subtractAndGet(v: A): A

    Subtracts from the atomic number and returns the result.

Concrete Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final macro def +=(value: A): Unit

    Subtracts from the atomic number the given value.

    Subtracts from the atomic number the given value. Alias for subtract.

  4. final macro def -=(value: A): Unit

    Adds to the atomic number the given value.

    Adds to the atomic number the given value. Alias for add.

  5. final macro def :=(value: A): Unit

    Alias for set.

    Alias for set. Updates the current value.

    value

    will be the new value returned by get()

    Definition Classes
    Atomic
  6. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  7. final macro def apply(): A

    Get the current value persisted by this Atomic, an alias for get().

    Get the current value persisted by this Atomic, an alias for get().

    Definition Classes
    Atomic
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  10. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  11. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  12. final macro def getAndTransform(cb: (A) => A): A

    Abstracts over compareAndSet.

    Abstracts over compareAndSet. You specify a transformation by specifying a callback to be executed, a callback that transforms the current value. This method will loop until it will succeed in replacing the current value with the one produced by the given callback.

    Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.

    cb

    is a callback that receives the current value as input and returns the update which is the new value that should be persisted

    returns

    the old value, just prior to when the successful update happened

    Definition Classes
    Atomic
  13. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  14. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  15. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  16. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  17. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  18. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  19. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  20. def toString(): String
    Definition Classes
    AnyRef → Any
  21. final macro def transform(cb: (A) => A): Unit

    Abstracts over compareAndSet.

    Abstracts over compareAndSet. You specify a transformation by specifying a callback to be executed, a callback that transforms the current value. This method will loop until it will succeed in replacing the current value with the one produced by the given callback.

    Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.

    cb

    is a callback that receives the current value as input and returns the update which is the new value that should be persisted

    Definition Classes
    Atomic
  22. final macro def transformAndExtract[U](cb: (A) => (U, A)): U

    Abstracts over compareAndSet.

    Abstracts over compareAndSet. You specify a transformation by specifying a callback to be executed, a callback that transforms the current value. This method will loop until it will succeed in replacing the current value with the one produced by your callback.

    Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.

    cb

    is a callback that receives the current value as input and returns a tuple that specifies the update + what should this method return when the operation succeeds.

    returns

    whatever was specified by your callback, once the operation succeeds

    Definition Classes
    Atomic
  23. final macro def transformAndGet(cb: (A) => A): A

    Abstracts over compareAndSet.

    Abstracts over compareAndSet. You specify a transformation by specifying a callback to be executed, a callback that transforms the current value. This method will loop until it will succeed in replacing the current value with the one produced by the given callback.

    Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.

    cb

    is a callback that receives the current value as input and returns the update which is the new value that should be persisted

    returns

    whatever the update is, after the operation succeeds

    Definition Classes
    Atomic
  24. final macro def update(value: A): Unit

    Alias for set.

    Alias for set. Updates the current value.

    value

    will be the new value returned by get()

    Definition Classes
    Atomic
  25. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  26. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  27. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated @deprecated
    Deprecated

    (Since version ) see corresponding Javadoc for more information.

Inherited from Atomic[A]

Inherited from Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped