站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 common API Documentation 英文版文档

MuDouble (JBoss/Common API) - JBoss 4.0.1 sp1 common API Documentation 英文版文档


org.jboss.util
Class MuDouble

java.lang.Object
  extended byjava.lang.Number
      extended byorg.jboss.util.MuNumber
          extended byorg.jboss.util.MuDouble
All Implemented Interfaces:
Cloneable, Comparable, Mutable, Serializable

public class MuDouble
extends MuNumber

A mutable double class.

Version:
$Revision: 1.1 $
Author:
Jason Dillon
See Also:
Serialized Form

Constructor Summary
MuDouble()
          Construct a new mutable double.
MuDouble(double d)
          Construct a new mutable double.
MuDouble(Object obj)
          Construct a new mutable double.
 
Method Summary
 double add(double amount)
          Add the specified amount.
 byte byteValue()
          Return the byte value of this object.
 Object clone()
          Return a cloned copy of this mutable double.
 boolean commit(double assumed, double b)
          Set the value to value only if the current value is equal to the assumed value.
 int compareTo(double other)
          Compares this object with the specified double for order.
 int compareTo(Object obj)
          Compares this object with the specified object for order.
 double divide(double factor)
          Divide by the specified factor.
 double doubleValue()
          Return the double value of this object.
 boolean equals(Object obj)
          Test the equality of this mutable double with another object.
 float floatValue()
          Return the float value of this object.
 double get()
          Get the current value.
 Object getValue()
          Get the value of this mutable double.
 int hashCode()
          Get the hash code for this mutable double.
 int intValue()
          Return the int value of this object.
 long longValue()
          Return the long value of this object.
 double multiply(double factor)
          Multiply by the specified factor.
 double negate()
          Set the value to the negative of its current value.
 double set(double f)
          Set the value.
 void setValue(Object obj)
          Set the value of this mutable double.
 short shortValue()
          Return the short value of this object.
 double subtract(double amount)
          Subtract the specified amount.
 double swap(MuDouble b)
          Swap values with another mutable double.
 String toString()
          Convert this mutable double to a string.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MuDouble

public MuDouble()
Construct a new mutable double.


MuDouble

public MuDouble(double d)
Construct a new mutable double.

Parameters:
d - double value.

MuDouble

public MuDouble(Object obj)
Construct a new mutable double.

Parameters:
obj - Object to convert to a double value.
Method Detail

set

public double set(double f)
Set the value.

Parameters:
f - double value.
Returns:
The previous value.

get

public double get()
Get the current value.

Returns:
The current value.

commit

public boolean commit(double assumed,
                      double b)
Set the value to value only if the current value is equal to the assumed value.

Parameters:
assumed - The assumed value.
b - The new value.
Returns:
True if value was changed.

swap

public double swap(MuDouble b)
Swap values with another mutable double.

Parameters:
b - Mutable double to swap values with.
Returns:
The new value.

add

public double add(double amount)
Add the specified amount.

Parameters:
amount - Amount to add.
Returns:
The new value.

subtract

public double subtract(double amount)
Subtract the specified amount.

Parameters:
amount - Amount to subtract.
Returns:
The new value.

multiply

public double multiply(double factor)
Multiply by the specified factor.

Parameters:
factor - Factor to multiply by.
Returns:
The new value.

divide

public double divide(double factor)
Divide by the specified factor.

Parameters:
factor - Factor to divide by.
Returns:
The new value.

negate

public double negate()
Set the value to the negative of its current value.

Returns:
The new value.

compareTo

public int compareTo(double other)
Compares this object with the specified double for order.

Parameters:
other - Value to compare with.
Returns:
A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

compareTo

public int compareTo(Object obj)
Compares this object with the specified object for order.

Returns:
A negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Throws:
ClassCastException - Object is not a MuDouble.

toString

public String toString()
Convert this mutable double to a string.

Returns:
String value.

hashCode

public int hashCode()
Get the hash code for this mutable double.

Returns:
Hash code.

equals

public boolean equals(Object obj)
Test the equality of this mutable double with another object.

Parameters:
obj - Object to test
Returns:
Is equal

clone

public Object clone()
Return a cloned copy of this mutable double.

Returns:
Cloaned mutable double.

byteValue

public byte byteValue()
Return the byte value of this object.

Overrides:
byteValue in class MuNumber
Returns:
byte value.

shortValue

public short shortValue()
Return the short value of this object.

Overrides:
shortValue in class MuNumber
Returns:
short value.

intValue

public int intValue()
Return the int value of this object.

Overrides:
intValue in class MuNumber
Returns:
int value.

longValue

public long longValue()
Return the long value of this object.

Returns:
long value.

floatValue

public float floatValue()
Return the float value of this object.

Overrides:
floatValue in class MuNumber
Returns:
float value.

doubleValue

public double doubleValue()
Return the double value of this object.

Returns:
double value.

setValue

public void setValue(Object obj)
Set the value of this mutable double.

Parameters:
obj - Object to convert to a double value.
Throws:
NotCoercibleException - Can not convert to double.

getValue

public Object getValue()
Get the value of this mutable double.

Returns:
java.lang.Double value


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.