Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
Number
org.apache.commons.lang.mutable.MutableFloat
float
wrapper.
Float
Constructor Summary | |
| |
| |
|
Method Summary | |
int |
|
double |
|
boolean |
|
float |
|
Object |
|
int |
|
int |
|
boolean |
|
boolean |
|
long |
|
void |
|
void |
|
String |
|
public MutableFloat()
Constructs a new MutableFloat with the default value of zero.
public MutableFloat(Number value)
Constructs a new MutableFloat with the specified value.
- Parameters:
value
- a value.
public MutableFloat(float value)
Constructs a new MutableFloat with the specified value.
- Parameters:
value
- a value.
public int compareTo(Object obj)
Compares this mutable to another in ascending order.
- Parameters:
obj
- the mutable to compare to
- Returns:
- negative if this is less, zero if equal, positive if greater
public double doubleValue()
Returns the value of this MutableFloat as a double.
- Returns:
- the numeric value represented by this object after conversion to type double.
public boolean equals(Object obj)
Compares this object against some other object. The result istrue
if and only if the argument is notnull
and is aFloat
object that represents afloat
that has the identical bit pattern to the bit pattern of thefloat
represented by this object. For this purpose, two float values are considered to be the same if and only if the methodFloat.floatToIntBits(float)
returns the same int value when applied to each. Note that in most cases, for two instances of classFloat
,f1
andf2
, the value off1.equals(f2)
istrue
if and only ifalso has the valuef1.floatValue() == f2.floatValue()true
. However, there are two exceptions:This definition allows hashtables to operate properly.
- If
f1
andf2
both representFloat.NaN
, then theequals
method returnstrue
, even thoughFloat.NaN==Float.NaN
has the valuefalse
.- If
f1
represents+0.0f
whilef2
represents-0.0f
, or vice versa, theequal
test has the valuefalse
, even though0.0f==-0.0f
has the valuetrue
.
- Parameters:
obj
- the object to be compared
- Returns:
true
if the objects are the same;false
otherwise.
- See Also:
Float.floatToIntBits(float)
public float floatValue()
Returns the value of this MutableFloat as a float.
- Returns:
- the numeric value represented by this object after conversion to type float.
public Object getValue()
Gets the value as a Float instance.
- Returns:
- the value as a Float
public int hashCode()
Returns a suitable hashcode for this mutable.
- Returns:
- a suitable hashcode
public int intValue()
Returns the value of this MutableFloat as a int.
- Returns:
- the numeric value represented by this object after conversion to type int.
public boolean isInfinite()
Checks whether the float value is infinite.
- Returns:
- true if infinite
public boolean isNaN()
Checks whether the float value is the special NaN value.
- Returns:
- true if NaN
public long longValue()
Returns the value of this MutableFloat as a long.
- Returns:
- the numeric value represented by this object after conversion to type long.
public void setValue(Object value)
Sets the value from any Number instance.
- Parameters:
value
- the value to set
public void setValue(float value)
Sets the value.
- Parameters:
value
- the value to set
public String toString()
Returns the String value of this mutable.
- Returns:
- the mutable value as a string