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. * Constructs a new MutableBoolean with the specified value.
* *
* @param value * @param value the initial value to store
* a value.
*/ */
public MutableBoolean(boolean value) { public MutableBoolean(boolean value) {
super(); super();
@ -60,10 +59,8 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/** /**
* Constructs a new MutableBoolean with the specified value. * Constructs a new MutableBoolean with the specified value.
* *
* @param value * @param value the initial value to store, not null
* a value. * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public MutableBoolean(Boolean value) { public MutableBoolean(Boolean value) {
super(); super();
@ -94,11 +91,9 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/** /**
* Compares this mutable to another in ascending order. * Compares this mutable to another in ascending order.
* *
* @param other * @param other the other mutable to compare to, not null
* the mutable to compare to * @return negative if this is less, zero if equal, positive if greater
* @return zero if this object represents the same boolean value as the argument; a positive value if this object * where false is less than true
* represents true and the argument represents false; and a negative value if this object represents false
* and the argument represents true
*/ */
public int compareTo(MutableBoolean other) { public int compareTo(MutableBoolean other) {
boolean anotherVal = other.value; 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 * not <code>null</code> and is an <code>MutableBoolean</code> object that contains the same
* <code>boolean</code> value as this object. * <code>boolean</code> value as this object.
* *
* @param obj * @param obj the object to compare with, null returns false
* the object to compare with.
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise. * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/ */
@Override @Override
@ -127,17 +121,16 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/** /**
* Gets the value as a Boolean instance. * Gets the value as a Boolean instance.
* *
* @return the value as a Boolean * @return the value as a Boolean, never null
*/ */
public Boolean getValue() { public Boolean getValue() {
return Boolean.valueOf(this.value); 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 * @return the hash code returned by <code>Boolean.TRUE</code> or <code>Boolean.FALSE</code>
* <code>1237</code> if this object represents <code>false</code>.
*/ */
@Override @Override
public int hashCode() { public int hashCode() {
@ -147,8 +140,7 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/** /**
* Sets the value. * Sets the value.
* *
* @param value * @param value the value to set
* the value to set
*/ */
public void setValue(boolean value) { public void setValue(boolean value) {
this.value = value; this.value = value;
@ -157,15 +149,14 @@ public class MutableBoolean implements Mutable<Boolean>, Serializable, Comparabl
/** /**
* Sets the value from any Boolean instance. * Sets the value from any Boolean instance.
* *
* @param value * @param value the value to set, not null
* the value to set * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public void setValue(Boolean value) { public void setValue(Boolean value) {
this.value = value.booleanValue(); this.value = value.booleanValue();
} }
//-----------------------------------------------------------------------
/** /**
* Returns the String value of this mutable. * 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. * Constructs a new MutableByte with the specified value.
* *
* @param value * @param value the initial value to store
* a value.
*/ */
public MutableByte(byte value) { public MutableByte(byte value) {
super(); super();
@ -56,10 +55,8 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/** /**
* Constructs a new MutableByte with the specified value. * Constructs a new MutableByte with the specified value.
* *
* @param value * @param value the initial value to store, not null
* a value. * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public MutableByte(Number value) { public MutableByte(Number value) {
super(); super();
@ -69,10 +66,8 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/** /**
* Constructs a new MutableByte parsing the given string. * Constructs a new MutableByte parsing the given string.
* *
* @param value * @param value the string to parse, not null
* the string to parse. * @throws NumberFormatException if the string cannot be parsed into a byte
* @throws NumberFormatException
* if the string cannot be parsed into a byte
*/ */
public MutableByte(String value) throws NumberFormatException { public MutableByte(String value) throws NumberFormatException {
super(); super();
@ -83,7 +78,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/** /**
* Gets the value as a Byte instance. * Gets the value as a Byte instance.
* *
* @return the value as a Byte * @return the value as a Byte, never null
*/ */
public Byte getValue() { public Byte getValue() {
return Byte.valueOf(this.value); return Byte.valueOf(this.value);
@ -92,8 +87,7 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/** /**
* Sets the value. * Sets the value.
* *
* @param value * @param value the value to set
* the value to set
*/ */
public void setValue(byte value) { public void setValue(byte value) {
this.value = value; this.value = value;
@ -102,10 +96,8 @@ public class MutableByte extends Number implements Comparable<MutableByte>, Muta
/** /**
* Sets the value from any Number instance. * Sets the value from any Number instance.
* *
* @param value * @param value the value to set, not null
* the value to set * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public void setValue(Number value) { public void setValue(Number value) {
this.value = value.byteValue(); 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. * @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 * @param operand the value to add, not null
* the value to add
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void add(byte operand) { 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 * @param operand the value to add, not null
* the value to add * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void add(Number operand) { 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 * @param operand the value to subtract, not null
* the value to add
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void subtract(byte operand) { 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 * @param operand the value to subtract, not null
* the value to add * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void subtract(Number operand) { 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 * Compares this object to the specified object. The result is <code>true</code> if and only if the argument is
* is not <code>null</code> and is a <code>MutableByte</code> object that contains the same <code>byte</code> * not <code>null</code> and is a <code>MutableByte</code> object that contains the same <code>byte</code> value
* value as this object. * as this object.
* *
* @param obj * @param obj the object to compare with, null returns false
* the object to compare with.
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise. * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/ */
@Override @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 @Override
public int hashCode() { public int hashCode() {
return value; return value;
} }
//-----------------------------------------------------------------------
/** /**
* Compares this mutable to another in ascending order. * Compares this mutable to another in ascending order.
* *
* @param other * @param other the other mutable to compare to, not null
* the mutable to compare to
* @return negative if this is less, zero if equal, positive if greater * @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) { public int compareTo(MutableByte other) {
byte anotherVal = other.value; byte anotherVal = other.value;
return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1); return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
} }
//-----------------------------------------------------------------------
/** /**
* Returns the String value of this mutable. * 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. * Constructs a new MutableDouble with the specified value.
* *
* @param value * @param value the initial value to store
* a value.
*/ */
public MutableDouble(double value) { public MutableDouble(double value) {
super(); super();
@ -56,10 +55,8 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/** /**
* Constructs a new MutableDouble with the specified value. * Constructs a new MutableDouble with the specified value.
* *
* @param value * @param value the initial value to store, not null
* a value. * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public MutableDouble(Number value) { public MutableDouble(Number value) {
super(); super();
@ -69,10 +66,8 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/** /**
* Constructs a new MutableDouble parsing the given string. * Constructs a new MutableDouble parsing the given string.
* *
* @param value * @param value the string to parse, not null
* the string to parse. * @throws NumberFormatException if the string cannot be parsed into a double
* @throws NumberFormatException
* if the string cannot be parsed into a double
*/ */
public MutableDouble(String value) throws NumberFormatException { public MutableDouble(String value) throws NumberFormatException {
super(); super();
@ -83,7 +78,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/** /**
* Gets the value as a Double instance. * Gets the value as a Double instance.
* *
* @return the value as a Double * @return the value as a Double, never null
*/ */
public Double getValue() { public Double getValue() {
return new Double(this.value); return new Double(this.value);
@ -92,8 +87,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/** /**
* Sets the value. * Sets the value.
* *
* @param value * @param value the value to set
* the value to set
*/ */
public void setValue(double value) { public void setValue(double value) {
this.value = value; this.value = value;
@ -102,10 +96,8 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
/** /**
* Sets the value from any Number instance. * Sets the value from any Number instance.
* *
* @param value * @param value the value to set, not null
* the value to set * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public void setValue(Number value) { public void setValue(Number value) {
this.value = value.doubleValue(); this.value = value.doubleValue();
@ -114,7 +106,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
//----------------------------------------------------------------------- //-----------------------------------------------------------------------
// shortValue and bytValue rely on Number implementation // 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. * @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 * @param operand the value to add
* the value to add
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void add(double operand) { 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 * @param operand the value to add, not null
* the value to add * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void add(Number operand) { 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 * @param operand the value to subtract, not null
* the value to add
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void subtract(double operand) { 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 * @param operand the value to subtract, not null
* the value to add * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void subtract(Number operand) { 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. * <code>+0.0==-0.0</code> has the value <code>true</code>. This allows hashtables to operate properly.
* </ul> * </ul>
* *
* @param obj * @param obj the object to compare with, null returns false
* the object to compare with.
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise. * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/ */
@Override @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 @Override
public int hashCode() { public int hashCode() {
@ -301,11 +282,11 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
return (int) (bits ^ (bits >>> 32)); return (int) (bits ^ (bits >>> 32));
} }
//-----------------------------------------------------------------------
/** /**
* Compares this mutable to another in ascending order. * Compares this mutable to another in ascending order.
* *
* @param other * @param other the other mutable to compare to, not null
* the mutable to compare to
* @return negative if this is less, zero if equal, positive if greater * @return negative if this is less, zero if equal, positive if greater
*/ */
public int compareTo(MutableDouble other) { public int compareTo(MutableDouble other) {
@ -313,6 +294,7 @@ public class MutableDouble extends Number implements Comparable<MutableDouble>,
return Double.compare(value, anotherVal); return Double.compare(value, anotherVal);
} }
//-----------------------------------------------------------------------
/** /**
* Returns the String value of this mutable. * 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. * Constructs a new MutableFloat with the specified value.
* *
* @param value * @param value the initial value to store
* a value.
*/ */
public MutableFloat(float value) { public MutableFloat(float value) {
super(); super();
@ -56,10 +55,8 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/** /**
* Constructs a new MutableFloat with the specified value. * Constructs a new MutableFloat with the specified value.
* *
* @param value * @param value the initial value to store, not null
* a value. * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public MutableFloat(Number value) { public MutableFloat(Number value) {
super(); super();
@ -69,10 +66,8 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/** /**
* Constructs a new MutableFloat parsing the given string. * Constructs a new MutableFloat parsing the given string.
* *
* @param value * @param value the string to parse, not null
* the string to parse. * @throws NumberFormatException if the string cannot be parsed into a float
* @throws NumberFormatException
* if the string cannot be parsed into a float
*/ */
public MutableFloat(String value) throws NumberFormatException { public MutableFloat(String value) throws NumberFormatException {
super(); super();
@ -83,7 +78,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/** /**
* Gets the value as a Float instance. * Gets the value as a Float instance.
* *
* @return the value as a Float * @return the value as a Float, never null
*/ */
public Float getValue() { public Float getValue() {
return new Float(this.value); return new Float(this.value);
@ -92,8 +87,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/** /**
* Sets the value. * Sets the value.
* *
* @param value * @param value the value to set
* the value to set
*/ */
public void setValue(float value) { public void setValue(float value) {
this.value = value; this.value = value;
@ -102,10 +96,8 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
/** /**
* Sets the value from any Number instance. * Sets the value from any Number instance.
* *
* @param value * @param value the value to set, not null
* the value to set * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public void setValue(Number value) { public void setValue(Number value) {
this.value = value.floatValue(); 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 * @param operand the value to add, not null
* the value to add
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void add(float operand) { 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 * @param operand the value to add, not null
* the value to add * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void add(Number operand) { 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 * @param operand the value to subtract
* the value to add
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void subtract(float operand) { 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 * @param operand the value to subtract, not null
* the value to add * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void subtract(Number operand) { 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 // 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. * @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> * </ul>
* This definition allows hashtables to operate properly. * This definition allows hashtables to operate properly.
* *
* @param obj * @param obj the object to compare with, null returns false
* the object to be compared
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise. * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
* @see java.lang.Float#floatToIntBits(float) * @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)); && (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 @Override
public int hashCode() { public int hashCode() {
return Float.floatToIntBits(value); return Float.floatToIntBits(value);
} }
//-----------------------------------------------------------------------
/** /**
* Compares this mutable to another in ascending order. * Compares this mutable to another in ascending order.
* *
* @param other * @param other the other mutable to compare to, not null
* the mutable to compare to
* @return negative if this is less, zero if equal, positive if greater * @return negative if this is less, zero if equal, positive if greater
*/ */
public int compareTo(MutableFloat other) { public int compareTo(MutableFloat other) {
@ -315,6 +295,7 @@ public class MutableFloat extends Number implements Comparable<MutableFloat>, Mu
return Float.compare(value, anotherVal); return Float.compare(value, anotherVal);
} }
//-----------------------------------------------------------------------
/** /**
* Returns the String value of this mutable. * 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. * Constructs a new MutableInt with the specified value.
* *
* @param value * @param value the initial value to store
* a value.
*/ */
public MutableInt(int value) { public MutableInt(int value) {
super(); super();
@ -56,10 +55,8 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/** /**
* Constructs a new MutableInt with the specified value. * Constructs a new MutableInt with the specified value.
* *
* @param value * @param value the initial value to store, not null
* a value. * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public MutableInt(Number value) { public MutableInt(Number value) {
super(); super();
@ -69,10 +66,8 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/** /**
* Constructs a new MutableInt parsing the given string. * Constructs a new MutableInt parsing the given string.
* *
* @param value * @param value the string to parse, not null
* the string to parse. * @throws NumberFormatException if the string cannot be parsed into an int
* @throws NumberFormatException
* if the string cannot be parsed into an int
*/ */
public MutableInt(String value) throws NumberFormatException { public MutableInt(String value) throws NumberFormatException {
super(); super();
@ -83,7 +78,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/** /**
* Gets the value as a Integer instance. * Gets the value as a Integer instance.
* *
* @return the value as a Integer * @return the value as a Integer, never null
*/ */
public Integer getValue() { public Integer getValue() {
return new Integer(this.value); return new Integer(this.value);
@ -92,8 +87,7 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/** /**
* Sets the value. * Sets the value.
* *
* @param value * @param value the value to set
* the value to set
*/ */
public void setValue(int value) { public void setValue(int value) {
this.value = value; this.value = value;
@ -102,12 +96,8 @@ public class MutableInt extends Number implements Comparable<MutableInt>, Mutabl
/** /**
* Sets the value from any Number instance. * Sets the value from any Number instance.
* *
* @param value * @param value the value to set, not null
* the value to set * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
* @throws ClassCastException
* if the type is not a {@link Number}
*/ */
public void setValue(Number value) { public void setValue(Number value) {
this.value = value.intValue(); 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 * @param operand the value to add, not null
* the value to add
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void add(int operand) { 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 * @param operand the value to add, not null
* the value to add * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void add(Number operand) { 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 * @param operand the value to subtract, not null
* the value to add
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void subtract(int operand) { 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 * @param operand the value to subtract, not null
* the value to add * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void subtract(Number operand) { 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 // 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. * @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 * 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. * as this object.
* *
* @param obj * @param obj the object to compare with, null returns false
* the object to compare with.
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise. * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/ */
@Override @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 @Override
public int hashCode() { public int hashCode() {
return value; return value;
} }
//-----------------------------------------------------------------------
/** /**
* Compares this mutable to another in ascending order. * Compares this mutable to another in ascending order.
* *
* @param other * @param other the other mutable to compare to, not null
* the mutable to compare to
* @return negative if this is less, zero if equal, positive if greater * @return negative if this is less, zero if equal, positive if greater
*/ */
public int compareTo(MutableInt other) { 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); return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
} }
//-----------------------------------------------------------------------
/** /**
* Returns the String value of this mutable. * 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. * Constructs a new MutableLong with the specified value.
* *
* @param value * @param value the initial value to store
* a value.
*/ */
public MutableLong(long value) { public MutableLong(long value) {
super(); super();
@ -56,10 +55,8 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/** /**
* Constructs a new MutableLong with the specified value. * Constructs a new MutableLong with the specified value.
* *
* @param value * @param value the initial value to store, not null
* a value. * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public MutableLong(Number value) { public MutableLong(Number value) {
super(); super();
@ -69,10 +66,8 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/** /**
* Constructs a new MutableLong parsing the given string. * Constructs a new MutableLong parsing the given string.
* *
* @param value * @param value the string to parse, not null
* the string to parse. * @throws NumberFormatException if the string cannot be parsed into a long
* @throws NumberFormatException
* if the string cannot be parsed into a long
*/ */
public MutableLong(String value) throws NumberFormatException { public MutableLong(String value) throws NumberFormatException {
super(); super();
@ -83,7 +78,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/** /**
* Gets the value as a Long instance. * Gets the value as a Long instance.
* *
* @return the value as a Long * @return the value as a Long, never null
*/ */
public Long getValue() { public Long getValue() {
return new Long(this.value); return new Long(this.value);
@ -92,8 +87,7 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/** /**
* Sets the value. * Sets the value.
* *
* @param value * @param value the value to set
* the value to set
*/ */
public void setValue(long value) { public void setValue(long value) {
this.value = value; this.value = value;
@ -102,10 +96,8 @@ public class MutableLong extends Number implements Comparable<MutableLong>, Muta
/** /**
* Sets the value from any Number instance. * Sets the value from any Number instance.
* *
* @param value * @param value the value to set, not null
* the value to set * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public void setValue(Number value) { public void setValue(Number value) {
this.value = value.longValue(); 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 * @param operand the value to add, not null
* the value to add
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void add(long operand) { 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 * @param operand the value to add, not null
* the value to add * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void add(Number operand) { 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 * @param operand the value to subtract, not null
* the value to add
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void subtract(long operand) { 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 * @param operand the value to subtract, not null
* the value to add * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void subtract(Number operand) { 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 // 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. * @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> * is not <code>null</code> and is a <code>MutableLong</code> object that contains the same <code>long</code>
* value as this object. * value as this object.
* *
* @param obj * @param obj the object to compare with, null returns false
* the object to compare with.
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise. * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/ */
@Override @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 @Override
public int hashCode() { public int hashCode() {
return (int) (value ^ (value >>> 32)); return (int) (value ^ (value >>> 32));
} }
//-----------------------------------------------------------------------
/** /**
* Compares this mutable to another in ascending order. * Compares this mutable to another in ascending order.
* *
* @param other * @param other the other mutable to compare to, not null
* the mutable to compare to
* @return negative if this is less, zero if equal, positive if greater * @return negative if this is less, zero if equal, positive if greater
*/ */
public int compareTo(MutableLong other) { 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); return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
} }
//-----------------------------------------------------------------------
/** /**
* Returns the String value of this mutable. * 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. * Constructs a new MutableShort with the specified value.
* *
* @param value * @param value the initial value to store
* a value.
*/ */
public MutableShort(short value) { public MutableShort(short value) {
super(); super();
@ -56,10 +55,8 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/** /**
* Constructs a new MutableShort with the specified value. * Constructs a new MutableShort with the specified value.
* *
* @param value * @param value the initial value to store, not null
* a value. * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public MutableShort(Number value) { public MutableShort(Number value) {
super(); super();
@ -69,10 +66,8 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/** /**
* Constructs a new MutableShort parsing the given string. * Constructs a new MutableShort parsing the given string.
* *
* @param value * @param value the string to parse, not null
* the string to parse. * @throws NumberFormatException if the string cannot be parsed into a short
* @throws NumberFormatException
* if the string cannot be parsed into a short
*/ */
public MutableShort(String value) throws NumberFormatException { public MutableShort(String value) throws NumberFormatException {
super(); super();
@ -83,7 +78,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/** /**
* Gets the value as a Short instance. * Gets the value as a Short instance.
* *
* @return the value as a Short * @return the value as a Short, never null
*/ */
public Short getValue() { public Short getValue() {
return new Short(this.value); return new Short(this.value);
@ -92,8 +87,7 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/** /**
* Sets the value. * Sets the value.
* *
* @param value * @param value the value to set
* the value to set
*/ */
public void setValue(short value) { public void setValue(short value) {
this.value = value; this.value = value;
@ -102,10 +96,8 @@ public class MutableShort extends Number implements Comparable<MutableShort>, Mu
/** /**
* Sets the value from any Number instance. * Sets the value from any Number instance.
* *
* @param value * @param value the value to set, not null
* the value to set * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*/ */
public void setValue(Number value) { public void setValue(Number value) {
this.value = value.shortValue(); 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 * @param operand the value to add, not null
* the value to add
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void add(short operand) { 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 * @param operand the value to add, not null
* the value to add * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void add(Number operand) { 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 * @param operand the value to subtract, not null
* the value to add
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void subtract(short operand) { 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 * @param operand the value to subtract, not null
* the value to add * @throws NullPointerException if the object is null
* @throws NullPointerException
* if the object is null
*
* @since Commons Lang 2.2 * @since Commons Lang 2.2
*/ */
public void subtract(Number operand) { 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. * @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> * is not <code>null</code> and is a <code>MutableShort</code> object that contains the same <code>short</code>
* value as this object. * value as this object.
* *
* @param obj * @param obj the object to compare with, null returns false
* the object to compare with.
* @return <code>true</code> if the objects are the same; <code>false</code> otherwise. * @return <code>true</code> if the objects are the same; <code>false</code> otherwise.
*/ */
@Override @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 @Override
public int hashCode() { public int hashCode() {
return value; return value;
} }
//-----------------------------------------------------------------------
/** /**
* Compares this mutable to another in ascending order. * Compares this mutable to another in ascending order.
* *
* @param other * @param other the other mutable to compare to, not null
* the mutable to compare to
* @return negative if this is less, zero if equal, positive if greater * @return negative if this is less, zero if equal, positive if greater
*/ */
public int compareTo(MutableShort other) { 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); return value < anotherVal ? -1 : (value == anotherVal ? 0 : 1);
} }
//-----------------------------------------------------------------------
/** /**
* Returns the String value of this mutable. * Returns the String value of this mutable.
* *