|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.lang.Number
org.openmali.types.primitives.MutableLong
public class MutableLong
This a mutable derivation of the Long class.
Most of the code is borrowed from the Long class.
| Constructor Summary | |
|---|---|
MutableLong(long value)
Constructs a newly allocated MutableLong object that
represents the specified long argument. |
|
MutableLong(java.lang.String s)
Constructs a newly allocated MutableLong object that
represents the long value indicated by the
String parameter. |
|
| Method Summary | |
|---|---|
byte |
byteValue()
Returns the value of this MutableLong as a
byte. |
int |
compareTo(MutableLong anotherLong)
Compares two MutableLong objects numerically. |
double |
doubleValue()
Returns the value of this MutableLong as a
double. |
boolean |
equals(java.lang.Object obj)
Compares this object to the specified object. |
float |
floatValue()
Returns the value of this MutableLong as a
float. |
int |
hashCode()
Returns a hash code for this MutableLong. |
int |
intValue()
Returns the value of this MutableLong as an
int. |
long |
longValue()
Returns the value of this MutableLong as a
long value. |
void |
setValue(long value)
|
short |
shortValue()
Returns the value of this MutableLong as a
short. |
java.lang.String |
toString()
Returns a String object representing this
MutableLong's value. |
static MutableLong |
valueOf(long l)
Returns a MutableLong instance representing the specified long value. |
static MutableLong |
valueOf(java.lang.String s)
Returns a MutableLong object holding the value
of the specified String. |
static MutableLong |
valueOf(java.lang.String s,
int radix)
Returns a MutableLong 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 MutableLong(long value)
MutableLong object that
represents the specified long argument.
value - the value to be represented by the
MutableLong object.
public MutableLong(java.lang.String s)
throws java.lang.NumberFormatException
MutableLong object that
represents the long value indicated by the
String parameter. The string is converted to a
long value in exactly the manner used by the
parseLong method for radix 10.
s - the String to be converted to a
MutableLong.
java.lang.NumberFormatException - if the String does not
contain a parsable long.Long.parseLong(java.lang.String, int)| Method Detail |
|---|
public final void setValue(long value)
public final byte byteValue()
MutableLong as a
byte.
byteValue in class java.lang.Numberpublic final short shortValue()
MutableLong as a
short.
shortValue in class java.lang.Numberpublic final int intValue()
MutableLong as an
int.
intValue in class java.lang.Numberpublic final long longValue()
MutableLong as a
long value.
longValue in class java.lang.Numberpublic final float floatValue()
MutableLong as a
float.
floatValue in class java.lang.Numberpublic double doubleValue()
MutableLong as a
double.
doubleValue in class java.lang.Numberpublic java.lang.String toString()
String object representing this
MutableLong's value. The value is converted to signed
decimal representation and returned as a string, exactly as if
the long value were given as an argument to the
Long.toString(long) method.
toString in class java.lang.Objectpublic int hashCode()
MutableLong. The result is
the exclusive OR of the two halves of the primitive
long value held by this MutableLong
object. That is, the hashcode is the value of the expression:
(int)(this.longValue()^(this.longValue()>>>32))
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
true if and only if the argument is not
null and is a MutableLong object that
contains the same long 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(MutableLong anotherLong)
MutableLong objects numerically.
compareTo in interface java.lang.Comparable<MutableLong>anotherLong - the MutableLong to be compared.
0 if this MutableLong is
equal to the argument MutableLong; a value less than
0 if this MutableLong is numerically less
than the argument MutableLong; and a value greater
than 0 if this MutableLong is numerically
greater than the argument MutableLong (signed
comparison).
public static MutableLong valueOf(java.lang.String s,
int radix)
throws java.lang.NumberFormatException
MutableLong 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
long in the radix specified by the second
argument, exactly as if the arguments were given to the Long.parseLong(java.lang.String, int) method. The result is a
MutableLong object that represents the long
value specified by the string.
In other words, this method returns a MutableLong object equal
to the value of:
new MutableLong(Long.parseLong(s, radix))
s - the string to be parsedradix - the radix to be used in interpreting s
MutableLong object holding the value
represented by the string argument in the specified
radix.
java.lang.NumberFormatException - If the String does not
contain a parsable long.
public static MutableLong valueOf(java.lang.String s)
throws java.lang.NumberFormatException
MutableLong object holding the value
of the specified String. The argument is
interpreted as representing a signed decimal long,
exactly as if the argument were given to the Long.parseLong(java.lang.String) method. The result is a
MutableLong object that represents the integer value
specified by the string.
In other words, this method returns a MutableLong object
equal to the value of:
new MutableLong(Long.parseLong(s))
s - the string to be parsed.
MutableLong object holding the value
represented by the string argument.
java.lang.NumberFormatException - If the string cannot be parsed
as a long.public static MutableLong valueOf(long l)
MutableLong(long), as this method is likely to yield
significantly better space and time performance by caching
frequently requested values.
l - a long value.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||