edu.mit.jmwe.util
Class AtomicDouble<T,S>

java.lang.Object
  extended by java.lang.Number
      extended by edu.mit.jmwe.util.AtomicDouble<T,S>
All Implemented Interfaces:
Serializable

public class AtomicDouble<T,S>
extends Number

A double value that may be updated atomically. See the java.util.concurrent.atomic package specification for description of the properties of atomic variables. An AtomicDouble is used in applications such as atomically incremented counters, and cannot be used as a replacement for an Integer. However, this class does extend Number to allow uniform access by tools and utilities that deal with numerically-based classes.

Since:
jMWE 1.0.0
Version:
$Id: AtomicDouble.java 614 2011-05-06 23:44:50Z markaf $
Author:
M.A. Finlayson
See Also:
Serialized Form

Constructor Summary
AtomicDouble()
          Create a new AtomicDouble with initial value 0.
AtomicDouble(double initialValue)
          Create a new AtomicInteger with the given initial value.
 
Method Summary
 double doubleValue()
           
 float floatValue()
           
 double get()
          Get the current value.
 void increment(double amt)
          Increments the current value by the specified amount.
 int intValue()
           
 long longValue()
           
 void set(double newValue)
          Set to the given value.
 String toString()
           
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AtomicDouble

public AtomicDouble()
Create a new AtomicDouble with initial value 0.


AtomicDouble

public AtomicDouble(double initialValue)
Create a new AtomicInteger with the given initial value.

Parameters:
initialValue - the initial value
Method Detail

get

public final double get()
Get the current value.

Returns:
the current value

set

public final void set(double newValue)
Set to the given value.

Parameters:
newValue - the new value

increment

public void increment(double amt)
Increments the current value by the specified amount.

Since:
jMWE 1.0.0

toString

public String toString()
Overrides:
toString in class Object

intValue

public int intValue()
Specified by:
intValue in class Number

longValue

public long longValue()
Specified by:
longValue in class Number

floatValue

public float floatValue()
Specified by:
floatValue in class Number

doubleValue

public double doubleValue()
Specified by:
doubleValue in class Number


Copyright © 2011 Massachusetts Institute of Technology. All Rights Reserved.