org.jboss.util
Class MuFloat

java.lang.Object
  extended byjava.lang.Number
      extended byorg.jboss.util.MuNumber (src) 
          extended byorg.jboss.util.MuFloat
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable, Mutable (src) , java.io.Serializable

public class MuFloat
extends MuNumber (src)

A mutable float class.

See Also:
Serialized Form

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

Constructor Detail

MuFloat

public MuFloat()
Construct a new mutable float.


MuFloat

public MuFloat(float f)
Construct a new mutable float.

Parameters:
f - float value.

MuFloat

public MuFloat(java.lang.Object obj)
Construct a new mutable float.

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

set

public float set(float f)
Set the value.

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

get

public float get()
Get the current value.

Returns:
The current value.

commit

public boolean commit(float assumed,
                      float 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 float swap(MuFloat (src)  b)
Swap values with another mutable float.

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

add

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

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

subtract

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

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

multiply

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

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

divide

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

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

negate

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

Returns:
The new value.

compareTo

public int compareTo(float other)
Compares this object with the specified float 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(java.lang.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:
java.lang.ClassCastException - Object is not a MuFloat.

toString

public java.lang.String toString()
Convert this mutable float to a string.

Returns:
String value.

hashCode

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

Returns:
Hash code.

equals

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

Parameters:
obj - Object to test equality with.
Returns:
True if object is equal.

clone

public java.lang.Object clone()
Return a cloned copy of this mutable float.

Returns:
Cloaned mutable float.

byteValue

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

Overrides:
byteValue in class MuNumber (src)
Returns:
byte value.

shortValue

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

Overrides:
shortValue in class MuNumber (src)
Returns:
short value.

intValue

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

Overrides:
intValue in class MuNumber (src)
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 (src)
Returns:
float value.

doubleValue

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

Returns:
double value.

setValue

public void setValue(java.lang.Object obj)
Set the value of this mutable float.

Parameters:
obj - Object to convert to a float value.
Throws:
NotCoercibleException (src) - Can not convert to float.

getValue

public java.lang.Object getValue()
Get the float value of this mutable float.

Returns:
java.lang.Float value.