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

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


org.jboss.util
Class MuFloat

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

public class MuFloat
extends MuNumber

A mutable float class.

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

Constructor Summary
MuFloat()
          Construct a new mutable float.
MuFloat(float f)
          Construct a new mutable float.
MuFloat(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.
 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(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(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.
 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(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 b)
          Swap values with another mutable float.
 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(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 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(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 MuFloat.

toString

public 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(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 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
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 float.

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

getValue

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

Returns:
java.lang.Float value.


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