|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Number
org.openmali.types.MutableInteger
public class MutableInteger
This a mutable derivation of the Integer class.
Most of the code is borrowed from the Integer class.
| Constructor Summary | |
|---|---|
MutableInteger(int value)
Constructs a newly allocated MutableInteger object that
represents the specified int value. |
|
MutableInteger(java.lang.String s)
Constructs a newly allocated MutableInteger object that
represents the int value indicated by the
String parameter. |
|
| Method Summary | |
|---|---|
byte |
byteValue()
Returns the value of this MutableInteger as a
byte. |
int |
compareTo(MutableInteger anotherInteger)
Compares two MutableInteger objects numerically. |
double |
doubleValue()
Returns the value of this MutableInteger as a
double. |
boolean |
equals(java.lang.Object obj)
Compares this object to the specified object. |
float |
floatValue()
Returns the value of this MutableInteger as a
float. |
int |
hashCode()
Returns a hash code for this MutableInteger. |
int |
intValue()
Returns the value of this MutableInteger as an
int. |
long |
longValue()
Returns the value of this MutableInteger as a
long. |
void |
setValue(int value)
|
short |
shortValue()
Returns the value of this MutableInteger as a
short. |
java.lang.String |
toString()
Returns a String object representing this
MutableInteger's value. |
static MutableInteger |
valueOf(int i)
Returns a MutableInteger instance representing the specified int value. |
static MutableInteger |
valueOf(java.lang.String s)
Returns an MutableInteger object holding the
value of the specified String. |
static MutableInteger |
valueOf(java.lang.String s,
int radix)
Returns an MutableInteger object holding the value
extracted from the specified String when parsed
with the radix given by the second argument. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public MutableInteger(int value)
MutableInteger object that
represents the specified int value.
value - the value to be represented by the
MutableInteger object.
public MutableInteger(java.lang.String s)
throws java.lang.NumberFormatException
MutableInteger object that
represents the int value indicated by the
String parameter. The string is converted to an
int value in exactly the manner used by the
parseInt method for radix 10.
s - the String to be converted to an
MutableInteger.
java.lang.NumberFormatException - if the String does not
contain a parsable integer.Integer.parseInt(java.lang.String, int)| Method Detail |
|---|
public final void setValue(int value)
public final byte byteValue()
MutableInteger as a
byte.
byteValue in class java.lang.Numberpublic final short shortValue()
MutableInteger as a
short.
shortValue in class java.lang.Numberpublic final int intValue()
MutableInteger as an
int.
intValue in class java.lang.Numberpublic final long longValue()
MutableInteger as a
long.
longValue in class java.lang.Numberpublic final float floatValue()
MutableInteger as a
float.
floatValue in class java.lang.Numberpublic final double doubleValue()
MutableInteger as a
double.
doubleValue in class java.lang.Numberpublic java.lang.String toString()
String object representing this
MutableInteger's value. The value is converted to signed
decimal representation and returned as a string, exactly as if
the integer value were given as an argument to the Integer.toString(int) method.
toString in class java.lang.Objectpublic int hashCode()
MutableInteger.
hashCode in class java.lang.Objectint value represented by this
MutableInteger object.public boolean equals(java.lang.Object obj)
true if and only if the argument is not
null and is an MutableInteger object that
contains the same int value as this object.
equals in class java.lang.Objectobj - the object to compare with.
true if the objects are the same;
false otherwise.public int compareTo(MutableInteger anotherInteger)
MutableInteger objects numerically.
compareTo in interface java.lang.Comparable<MutableInteger>anotherInteger - the MutableInteger to be compared.
0 if this MutableInteger is
equal to the argument MutableInteger; a value less than
0 if this MutableInteger is numerically less
than the argument MutableInteger; and a value greater
than 0 if this MutableInteger is numerically
greater than the argument MutableInteger (signed
comparison).
public static MutableInteger valueOf(java.lang.String s,
int radix)
throws java.lang.NumberFormatException
MutableInteger object holding the value
extracted from the specified String when parsed
with the radix given by the second argument. The first argument
is interpreted as representing a signed integer in the radix
specified by the second argument, exactly as if the arguments
were given to the Integer.parseInt(java.lang.String, int)
method. The result is an MutableInteger object that
represents the integer value specified by the string.
In other words, this method returns an MutableInteger
object equal to the value of:
new MutableInteger(Integer.parseInt(s, radix))
s - the string to be parsed.radix - the radix to be used in interpreting s
MutableInteger object holding the value
represented by the string argument in the specified
radix.
java.lang.NumberFormatException - if the String
does not contain a parsable int.
public static MutableInteger valueOf(java.lang.String s)
throws java.lang.NumberFormatException
MutableInteger object holding the
value of the specified String. The argument is
interpreted as representing a signed decimal integer, exactly
as if the argument were given to the Integer.parseInt(java.lang.String) method. The result is an
MutableInteger object that represents the integer value
specified by the string.
In other words, this method returns an MutableInteger
object equal to the value of:
new MutableInteger(Integer.parseInt(s))
s - the string to be parsed.
MutableInteger object holding the value
represented by the string argument.
java.lang.NumberFormatException - if the string cannot be parsed
as an integer.public static MutableInteger valueOf(int i)
MutableInteger(int), as this method is likely to yield
significantly better space and time performance by caching
frequently requested values.
i - an int value.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||