Javadoc clarifications and tidy

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@830024 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Stephen Colebourne 2009-10-26 23:43:09 +00:00
parent 283fa00f77
commit 45008b994b
7 changed files with 176 additions and 297 deletions

View File

@ -49,8 +49,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Constructs a new MutableBoolean with the specified value.
*
* @param value
* a value.
* @param value the initial value to store
*/
public MutableBoolean(boolean value) {
super();
@ -60,10 +59,8 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Constructs a new MutableBoolean with the specified value.
*
* @param value
* a value.
* @throws NullPointerException
* if the object is null
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
public MutableBoolean(Boolean value) {
super();
@ -94,11 +91,9 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Compares this mutable to another in ascending order.
*
* @param other
* the mutable to compare to
* @return zero if this object represents the same boolean value as the argument; a positive value if this object
* represents true and the argument represents false; and a negative value if this object represents false
* and the argument represents true
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
* where false is less than true
*/
public int compareTo(MutableBoolean other) {
boolean anotherVal = other.value;
@ -111,8 +106,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
* not <code>null</code> and is an <code>MutableBoolean</code> object that contains the same
* <code>boolean</code> value as this object.
*
* @param obj
* the object to compare with.
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/
@Override
@ -127,17 +121,16 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Gets the value as a Boolean instance.
*
* @return the value as a Boolean
* @return the value as a Boolean, never null
*/
public Boolean getValue() {
return Boolean.valueOf(this.value);
}
/**
* Returns a suitable hashcode for this mutable.
* Returns a suitable hash code for this mutable.
*
* @return the integer <code>1231</code> if this object represents <code>true</code>; returns the integer
* <code>1237</code> if this object represents <code>false</code>.
* @return the hash code returned by <code>Boolean.TRUE</code> or <code>Boolean.FALSE</code>
*/
@Override
public int hashCode() {
@ -147,8 +140,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Sets the value.
*
* @param value
* the value to set
* @param value the value to set
*/
public void setValue(boolean value) {
this.value = value;
@ -157,15 +149,14 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/**
* Sets the value from any Boolean instance.
*
* @param value
* the value to set
* @throws NullPointerException
* if the object is null
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
public void setValue(Boolean value) {
this.value = value.booleanValue();
}
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
*

View File

@ -45,8 +45,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Constructs a new MutableByte with the specified value.
*
* @param value
* a value.
* @param value the initial value to store
*/
public MutableByte(byte value) {
super();
@ -56,10 +55,8 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Constructs a new MutableByte with the specified value.
*
* @param value
* a value.
* @throws NullPointerException
* if the object is null
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
public MutableByte(Number value) {
super();
@ -69,10 +66,8 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Constructs a new MutableByte parsing the given string.
*
* @param value
* the string to parse.
* @throws NumberFormatException
* if the string cannot be parsed into a byte
* @param value the string to parse, not null
* @throws NumberFormatException if the string cannot be parsed into a byte
*/
public MutableByte(String value) throws NumberFormatException {
super();
@ -83,7 +78,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Gets the value as a Byte instance.
*
* @return the value as a Byte
* @return the value as a Byte, never null
*/
public Byte getValue() {
return Byte.valueOf(this.value);
@ -92,8 +87,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Sets the value.
*
* @param value
* the value to set
* @param value the value to set
*/
public void setValue(byte value) {
this.value = value;
@ -102,10 +96,8 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/**
* Sets the value from any Number instance.
*
* @param value
* the value to set
* @throws NullPointerException
* if the object is null
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
public void setValue(Number value) {
this.value = value.byteValue();
@ -124,7 +116,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
}
/**
* Returns the value of this MutableByte as a int.
* Returns the value of this MutableByte as an int.
*
* @return the numeric value represented by this object after conversion to type int.
*/
@ -194,11 +186,9 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
//-----------------------------------------------------------------------
/**
* Adds a value.
* Adds a value to the value of this instance.
*
* @param operand
* the value to add
*
* @param operand the value to add, not null
* @since Commons Lang 2.2
*/
public void add(byte operand) {
@ -206,13 +196,10 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
}
/**
* Adds a value.
* Adds a value to the value of this instance.
*
* @param operand
* the value to add
* @throws NullPointerException
* if the object is null
*
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
*/
public void add(Number operand) {
@ -220,11 +207,9 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
}
/**
* Subtracts a value.
* Subtracts a value from the value of this instance.
*
* @param operand
* the value to add
*
* @param operand the value to subtract, not null
* @since Commons Lang 2.2
*/
public void subtract(byte operand) {
@ -232,13 +217,10 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
}
/**
* Subtracts a value.
* Subtracts a value from the value of this instance.
*
* @param operand
* the value to add
* @throws NullPointerException
* if the object is null
*
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
*/
public void subtract(Number operand) {
@ -247,12 +229,11 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
//-----------------------------------------------------------------------
/**
* Compares this object against the specified object. The result is <code>true</code> if and only if the argument
* is not <code>null</code> and is a <code>MutableByte</code> object that contains the same <code>byte</code>
* value as this object.
* Compares this object to the specified object. The result is <code>true</code> if and only if the argument is
* not <code>null</code> and is a <code>MutableByte</code> object that contains the same <code>byte</code> value
* as this object.
*
* @param obj
* the object to compare with.
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/
@Override
@ -264,28 +245,28 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
}
/**
* Returns a suitable hashcode for this mutable.
* Returns a suitable hash code for this mutable.
*
* @return a suitable hashcode
* @return a suitable hash code
*/
@Override
public int hashCode() {
return value;
}
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
*
* @param other
* the mutable to compare to
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
* @throws ClassCastException if the argument is not a MutableByte
*/
public int compareTo(MutableByte other) {
byte anotherVal = other.value;
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
}
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
*

View File

@ -45,8 +45,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Constructs a new MutableDouble with the specified value.
*
* @param value
* a value.
* @param value the initial value to store
*/
public MutableDouble(double value) {
super();
@ -56,10 +55,8 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Constructs a new MutableDouble with the specified value.
*
* @param value
* a value.
* @throws NullPointerException
* if the object is null
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
public MutableDouble(Number value) {
super();
@ -69,10 +66,8 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Constructs a new MutableDouble parsing the given string.
*
* @param value
* the string to parse.
* @throws NumberFormatException
* if the string cannot be parsed into a double
* @param value the string to parse, not null
* @throws NumberFormatException if the string cannot be parsed into a double
*/
public MutableDouble(String value) throws NumberFormatException {
super();
@ -83,7 +78,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Gets the value as a Double instance.
*
* @return the value as a Double
* @return the value as a Double, never null
*/
public Double getValue() {
return new Double(this.value);
@ -92,8 +87,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Sets the value.
*
* @param value
* the value to set
* @param value the value to set
*/
public void setValue(double value) {
this.value = value;
@ -102,10 +96,8 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/**
* Sets the value from any Number instance.
*
* @param value
* the value to set
* @throws NullPointerException
* if the object is null
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
public void setValue(Number value) {
this.value = value.doubleValue();
@ -114,7 +106,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
//-----------------------------------------------------------------------
// shortValue and bytValue rely on Number implementation
/**
* Returns the value of this MutableDouble as a int.
* Returns the value of this MutableDouble as an int.
*
* @return the numeric value represented by this object after conversion to type int.
*/
@ -202,11 +194,9 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
//-----------------------------------------------------------------------
/**
* Adds a value.
* Adds a value to the value of this instance.
*
* @param operand
* the value to add
*
* @param operand the value to add
* @since Commons Lang 2.2
*/
public void add(double operand) {
@ -214,13 +204,10 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
}
/**
* Adds a value.
* Adds a value to the value of this instance.
*
* @param operand
* the value to add
* @throws NullPointerException
* if the object is null
*
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
*/
public void add(Number operand) {
@ -228,11 +215,9 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
}
/**
* Subtracts a value.
* Subtracts a value from the value of this instance.
*
* @param operand
* the value to add
*
* @param operand the value to subtract, not null
* @since Commons Lang 2.2
*/
public void subtract(double operand) {
@ -240,13 +225,10 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
}
/**
* Subtracts a value.
* Subtracts a value from the value of this instance.
*
* @param operand
* the value to add
* @throws NullPointerException
* if the object is null
*
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
*/
public void subtract(Number operand) {
@ -280,8 +262,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
* <code>+0.0==-0.0</code> has the value <code>true</code>. This allows hashtables to operate properly.
* </ul>
*
* @param obj
* the object to compare with.
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/
@Override
@ -291,9 +272,9 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
}
/**
* Returns a suitable hashcode for this mutable.
* Returns a suitable hash code for this mutable.
*
* @return a suitable hashcode
* @return a suitable hash code
*/
@Override
public int hashCode() {
@ -301,11 +282,11 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
return (int) (bits ^ (bits >>> 32));
}
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
*
* @param other
* the mutable to compare to
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
public int compareTo(MutableDouble other) {
@ -313,6 +294,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
return Double.compare(value, anotherVal);
}
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
*

View File

@ -45,8 +45,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Constructs a new MutableFloat with the specified value.
*
* @param value
* a value.
* @param value the initial value to store
*/
public MutableFloat(float value) {
super();
@ -56,10 +55,8 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Constructs a new MutableFloat with the specified value.
*
* @param value
* a value.
* @throws NullPointerException
* if the object is null
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
public MutableFloat(Number value) {
super();
@ -69,10 +66,8 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Constructs a new MutableFloat parsing the given string.
*
* @param value
* the string to parse.
* @throws NumberFormatException
* if the string cannot be parsed into a float
* @param value the string to parse, not null
* @throws NumberFormatException if the string cannot be parsed into a float
*/
public MutableFloat(String value) throws NumberFormatException {
super();
@ -83,7 +78,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Gets the value as a Float instance.
*
* @return the value as a Float
* @return the value as a Float, never null
*/
public Float getValue() {
return new Float(this.value);
@ -92,8 +87,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Sets the value.
*
* @param value
* the value to set
* @param value the value to set
*/
public void setValue(float value) {
this.value = value;
@ -102,10 +96,8 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/**
* Sets the value from any Number instance.
*
* @param value
* the value to set
* @throws NullPointerException
* if the object is null
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
public void setValue(Number value) {
this.value = value.floatValue();
@ -132,11 +124,9 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
//-----------------------------------------------------------------------
/**
* Adds a value.
* Adds a value to the value of this instance.
*
* @param operand
* the value to add
*
* @param operand the value to add, not null
* @since Commons Lang 2.2
*/
public void add(float operand) {
@ -144,13 +134,10 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
}
/**
* Adds a value.
* Adds a value to the value of this instance.
*
* @param operand
* the value to add
* @throws NullPointerException
* if the object is null
*
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
*/
public void add(Number operand) {
@ -158,11 +145,9 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
}
/**
* Subtracts a value.
* Subtracts a value from the value of this instance.
*
* @param operand
* the value to add
*
* @param operand the value to subtract
* @since Commons Lang 2.2
*/
public void subtract(float operand) {
@ -170,13 +155,10 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
}
/**
* Subtracts a value.
* Subtracts a value from the value of this instance.
*
* @param operand
* the value to add
* @throws NullPointerException
* if the object is null
*
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
*/
public void subtract(Number operand) {
@ -186,7 +168,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
//-----------------------------------------------------------------------
// shortValue and bytValue rely on Number implementation
/**
* Returns the value of this MutableFloat as a int.
* Returns the value of this MutableFloat as an int.
*
* @return the numeric value represented by this object after conversion to type int.
*/
@ -281,8 +263,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
* </ul>
* This definition allows hashtables to operate properly.
*
* @param obj
* the object to be compared
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
* @see java.lang.Float#floatToIntBits(float)
*/
@ -292,22 +273,21 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
&& (Float.floatToIntBits(((MutableFloat) obj).value) == Float.floatToIntBits(value));
}
//-----------------------------------------------------------------------
/**
* Returns a suitable hashcode for this mutable.
* Returns a suitable hash code for this mutable.
*
* @return a suitable hashcode
* @return a suitable hash code
*/
@Override
public int hashCode() {
return Float.floatToIntBits(value);
}
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
*
* @param other
* the mutable to compare to
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
public int compareTo(MutableFloat other) {
@ -315,6 +295,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
return Float.compare(value, anotherVal);
}
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
*

View File

@ -45,8 +45,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Constructs a new MutableInt with the specified value.
*
* @param value
* a value.
* @param value the initial value to store
*/
public MutableInt(int value) {
super();
@ -56,10 +55,8 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Constructs a new MutableInt with the specified value.
*
* @param value
* a value.
* @throws NullPointerException
* if the object is null
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
public MutableInt(Number value) {
super();
@ -69,10 +66,8 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Constructs a new MutableInt parsing the given string.
*
* @param value
* the string to parse.
* @throws NumberFormatException
* if the string cannot be parsed into an int
* @param value the string to parse, not null
* @throws NumberFormatException if the string cannot be parsed into an int
*/
public MutableInt(String value) throws NumberFormatException {
super();
@ -83,7 +78,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Gets the value as a Integer instance.
*
* @return the value as a Integer
* @return the value as a Integer, never null
*/
public Integer getValue() {
return new Integer(this.value);
@ -92,8 +87,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Sets the value.
*
* @param value
* the value to set
* @param value the value to set
*/
public void setValue(int value) {
this.value = value;
@ -102,12 +96,8 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/**
* Sets the value from any Number instance.
*
* @param value
* the value to set
* @throws NullPointerException
* if the object is null
* @throws ClassCastException
* if the type is not a {@link Number}
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
public void setValue(Number value) {
this.value = value.intValue();
@ -134,11 +124,9 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
//-----------------------------------------------------------------------
/**
* Adds a value.
* Adds a value to the value of this instance.
*
* @param operand
* the value to add
*
* @param operand the value to add, not null
* @since Commons Lang 2.2
*/
public void add(int operand) {
@ -146,13 +134,10 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
}
/**
* Adds a value.
* Adds a value to the value of this instance.
*
* @param operand
* the value to add
* @throws NullPointerException
* if the object is null
*
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
*/
public void add(Number operand) {
@ -160,11 +145,9 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
}
/**
* Subtracts a value.
* Subtracts a value from the value of this instance.
*
* @param operand
* the value to add
*
* @param operand the value to subtract, not null
* @since Commons Lang 2.2
*/
public void subtract(int operand) {
@ -172,13 +155,10 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
}
/**
* Subtracts a value.
* Subtracts a value from the value of this instance.
*
* @param operand
* the value to add
* @throws NullPointerException
* if the object is null
*
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
*/
public void subtract(Number operand) {
@ -188,7 +168,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
//-----------------------------------------------------------------------
// shortValue and bytValue rely on Number implementation
/**
* Returns the value of this MutableInt as a int.
* Returns the value of this MutableInt as an int.
*
* @return the numeric value represented by this object after conversion to type int.
*/
@ -240,11 +220,10 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
//-----------------------------------------------------------------------
/**
* Compares this object to the specified object. The result is <code>true</code> if and only if the argument is
* not <code>null</code> and is an <code>MutableInt</code> object that contains the same <code>int</code> value
* not <code>null</code> and is a <code>MutableInt</code> object that contains the same <code>int</code> value
* as this object.
*
* @param obj
* the object to compare with.
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/
@Override
@ -256,20 +235,20 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
}
/**
* Returns a suitable hashcode for this mutable.
* Returns a suitable hash code for this mutable.
*
* @return a suitable hashcode
* @return a suitable hash code
*/
@Override
public int hashCode() {
return value;
}
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
*
* @param other
* the mutable to compare to
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
public int compareTo(MutableInt other) {
@ -277,6 +256,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
}
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
*

View File

@ -45,8 +45,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Constructs a new MutableLong with the specified value.
*
* @param value
* a value.
* @param value the initial value to store
*/
public MutableLong(long value) {
super();
@ -56,10 +55,8 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Constructs a new MutableLong with the specified value.
*
* @param value
* a value.
* @throws NullPointerException
* if the object is null
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
public MutableLong(Number value) {
super();
@ -69,10 +66,8 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Constructs a new MutableLong parsing the given string.
*
* @param value
* the string to parse.
* @throws NumberFormatException
* if the string cannot be parsed into a long
* @param value the string to parse, not null
* @throws NumberFormatException if the string cannot be parsed into a long
*/
public MutableLong(String value) throws NumberFormatException {
super();
@ -83,7 +78,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Gets the value as a Long instance.
*
* @return the value as a Long
* @return the value as a Long, never null
*/
public Long getValue() {
return new Long(this.value);
@ -92,8 +87,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Sets the value.
*
* @param value
* the value to set
* @param value the value to set
*/
public void setValue(long value) {
this.value = value;
@ -102,10 +96,8 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/**
* Sets the value from any Number instance.
*
* @param value
* the value to set
* @throws NullPointerException
* if the object is null
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
public void setValue(Number value) {
this.value = value.longValue();
@ -132,11 +124,9 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
//-----------------------------------------------------------------------
/**
* Adds a value.
* Adds a value to the value of this instance.
*
* @param operand
* the value to add
*
* @param operand the value to add, not null
* @since Commons Lang 2.2
*/
public void add(long operand) {
@ -144,13 +134,10 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
}
/**
* Adds a value.
* Adds a value to the value of this instance.
*
* @param operand
* the value to add
* @throws NullPointerException
* if the object is null
*
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
*/
public void add(Number operand) {
@ -158,11 +145,9 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
}
/**
* Subtracts a value.
* Subtracts a value from the value of this instance.
*
* @param operand
* the value to add
*
* @param operand the value to subtract, not null
* @since Commons Lang 2.2
*/
public void subtract(long operand) {
@ -170,13 +155,10 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
}
/**
* Subtracts a value.
* Subtracts a value from the value of this instance.
*
* @param operand
* the value to add
* @throws NullPointerException
* if the object is null
*
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
*/
public void subtract(Number operand) {
@ -186,7 +168,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
//-----------------------------------------------------------------------
// shortValue and bytValue rely on Number implementation
/**
* Returns the value of this MutableLong as a int.
* Returns the value of this MutableLong as an int.
*
* @return the numeric value represented by this object after conversion to type int.
*/
@ -237,12 +219,11 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
//-----------------------------------------------------------------------
/**
* Compares this object against the specified object. The result is <code>true</code> if and only if the argument
* Compares this object to the specified object. The result is <code>true</code> if and only if the argument
* is not <code>null</code> and is a <code>MutableLong</code> object that contains the same <code>long</code>
* value as this object.
*
* @param obj
* the object to compare with.
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/
@Override
@ -254,20 +235,20 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
}
/**
* Returns a suitable hashcode for this mutable.
* Returns a suitable hash code for this mutable.
*
* @return a suitable hashcode
* @return a suitable hash code
*/
@Override
public int hashCode() {
return (int) (value ^ (value >>> 32));
}
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
*
* @param other
* the mutable to compare to
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
public int compareTo(MutableLong other) {
@ -275,6 +256,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
}
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
*

View File

@ -45,8 +45,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Constructs a new MutableShort with the specified value.
*
* @param value
* a value.
* @param value the initial value to store
*/
public MutableShort(short value) {
super();
@ -56,10 +55,8 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Constructs a new MutableShort with the specified value.
*
* @param value
* a value.
* @throws NullPointerException
* if the object is null
* @param value the initial value to store, not null
* @throws NullPointerException if the object is null
*/
public MutableShort(Number value) {
super();
@ -69,10 +66,8 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Constructs a new MutableShort parsing the given string.
*
* @param value
* the string to parse.
* @throws NumberFormatException
* if the string cannot be parsed into a short
* @param value the string to parse, not null
* @throws NumberFormatException if the string cannot be parsed into a short
*/
public MutableShort(String value) throws NumberFormatException {
super();
@ -83,7 +78,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Gets the value as a Short instance.
*
* @return the value as a Short
* @return the value as a Short, never null
*/
public Short getValue() {
return new Short(this.value);
@ -92,8 +87,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Sets the value.
*
* @param value
* the value to set
* @param value the value to set
*/
public void setValue(short value) {
this.value = value;
@ -102,10 +96,8 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/**
* Sets the value from any Number instance.
*
* @param value
* the value to set
* @throws NullPointerException
* if the object is null
* @param value the value to set, not null
* @throws NullPointerException if the object is null
*/
public void setValue(Number value) {
this.value = value.shortValue();
@ -132,11 +124,9 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
//-----------------------------------------------------------------------
/**
* Adds a value.
* Adds a value to the value of this instance.
*
* @param operand
* the value to add
*
* @param operand the value to add, not null
* @since Commons Lang 2.2
*/
public void add(short operand) {
@ -144,13 +134,10 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
}
/**
* Adds a value.
* Adds a value to the value of this instance.
*
* @param operand
* the value to add
* @throws NullPointerException
* if the object is null
*
* @param operand the value to add, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
*/
public void add(Number operand) {
@ -158,11 +145,9 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
}
/**
* Subtracts a value.
* Subtracts a value from the value of this instance.
*
* @param operand
* the value to add
*
* @param operand the value to subtract, not null
* @since Commons Lang 2.2
*/
public void subtract(short operand) {
@ -170,13 +155,10 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
}
/**
* Subtracts a value.
* Subtracts a value from the value of this instance.
*
* @param operand
* the value to add
* @throws NullPointerException
* if the object is null
*
* @param operand the value to subtract, not null
* @throws NullPointerException if the object is null
* @since Commons Lang 2.2
*/
public void subtract(Number operand) {
@ -196,7 +178,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
}
/**
* Returns the value of this MutableShort as a int.
* Returns the value of this MutableShort as an int.
*
* @return the numeric value represented by this object after conversion to type int.
*/
@ -247,12 +229,11 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
//-----------------------------------------------------------------------
/**
* Compares this object against the specified object. The result is <code>true</code> if and only if the argument
* Compares this object to the specified object. The result is <code>true</code> if and only if the argument
* is not <code>null</code> and is a <code>MutableShort</code> object that contains the same <code>short</code>
* value as this object.
*
* @param obj
* the object to compare with.
* @param obj the object to compare with, null returns false
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/
@Override
@ -264,20 +245,20 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
}
/**
* Returns a suitable hashcode for this mutable.
* Returns a suitable hash code for this mutable.
*
* @return a suitable hashcode
* @return a suitable hash code
*/
@Override
public int hashCode() {
return value;
}
//-----------------------------------------------------------------------
/**
* Compares this mutable to another in ascending order.
*
* @param other
* the mutable to compare to
* @param other the other mutable to compare to, not null
* @return negative if this is less, zero if equal, positive if greater
*/
public int compareTo(MutableShort other) {
@ -285,6 +266,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
}
//-----------------------------------------------------------------------
/**
* Returns the String value of this mutable.
*