Class AtomicDouble

    • Constructor Detail

      • AtomicDouble

        public AtomicDouble()
        Default constructor which initializes the object with 0d
      • AtomicDouble

        public AtomicDouble​(double initialValue)
        Constructor which initialized the object with initialValue
        Parameters:
        initialValue - the initial value for the object
    • Method Detail

      • compareAndSet

        public final boolean compareAndSet​(float expect,
                                           float update)
        Atomically sets the value to the given updated value if the current value == the expected value.
        Parameters:
        expect - the expected value
        update - the new value
        Returns:
        true if successful. False return indicates that the actual value was not equal to the expected value.
        See Also:
        AtomicLong.compareAndSet(long, long)
      • set

        public final void set​(double newValue)
        Sets to the given value.
        Parameters:
        newValue - the new value
        See Also:
        AtomicLong.set(long)
      • get

        public final double get()
        Gets the current value.
        Returns:
        the current value
        See Also:
        AtomicLong.get()
      • getAndSet

        public final double getAndSet​(double newValue)
        Atomically sets to the given value and returns the old value.
        Parameters:
        newValue - the new value
        Returns:
        the previous value
        See Also:
        AtomicLong.getAndSet(long)
      • floatValue

        public float floatValue()
        returns the value as float
        Specified by:
        floatValue in class Number
        Returns:
        value as float
      • doubleValue

        public double doubleValue()
        returns the value as double
        Specified by:
        doubleValue in class Number
        Returns:
        value as double
      • intValue

        public int intValue()
        returns the value as int
        Specified by:
        intValue in class Number
        Returns:
        value as int
      • longValue

        public long longValue()
        returns the value as long
        Specified by:
        longValue in class Number
        Returns:
        value as long