commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From scolebou...@apache.org
Subject svn commit: r830028 - in /commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable: MutableBoolean.java MutableByte.java MutableDouble.java MutableFloat.java
Date Mon, 26 Oct 2009 23:50:32 GMT
Author: scolebourne
Date: Mon Oct 26 23:50:31 2009
New Revision: 830028

URL: http://svn.apache.org/viewvc?rev=830028&view=rev
Log:
Reorder methods for consistency within package

Modified:
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableByte.java
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableDouble.java
    commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableFloat.java

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java?rev=830028&r1=830027&r2=830028&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
(original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableBoolean.java
Mon Oct 26 23:50:31 2009
@@ -67,7 +67,36 @@
         this.value = value.booleanValue();
     }
 
-    // -----------------------------------------------------------------------
+    //-----------------------------------------------------------------------
+    /**
+     * Gets the value as a Boolean instance.
+     * 
+     * @return the value as a Boolean, never null
+     */
+    public Boolean getValue() {
+        return Boolean.valueOf(this.value);
+    }
+
+    /**
+     * Sets the value.
+     * 
+     * @param value  the value to set
+     */
+    public void setValue(boolean value) {
+        this.value = value;
+    }
+
+    /**
+     * Sets the value from any Boolean instance.
+     * 
+     * @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 value of this MutableBoolean as a boolean.
      * 
@@ -89,19 +118,6 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Compares this mutable to another in ascending order.
-     * 
-     * @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;
-        return value == anotherVal ? 0 : (value ? 1 : -1);
-    }
-
-    // -----------------------------------------------------------------------
-    /**
      * 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>MutableBoolean</code>
object that contains the same
      * <code>boolean</code> value as this object.
@@ -117,16 +133,6 @@
         return false;
     }
 
-    // -----------------------------------------------------------------------
-    /**
-     * Gets the value as a Boolean instance.
-     * 
-     * @return the value as a Boolean, never null
-     */
-    public Boolean getValue() {
-        return Boolean.valueOf(this.value);
-    }
-
     /**
      * Returns a suitable hash code for this mutable.
      * 
@@ -137,23 +143,17 @@
         return value ? Boolean.TRUE.hashCode() : Boolean.FALSE.hashCode();
     }
 
+    //-----------------------------------------------------------------------
     /**
-     * Sets the value.
-     * 
-     * @param value  the value to set
-     */
-    public void setValue(boolean value) {
-        this.value = value;
-    }
-
-    /**
-     * Sets the value from any Boolean instance.
+     * Compares this mutable to another in ascending order.
      * 
-     * @param value  the value to set, not null
-     * @throws NullPointerException if the object is null
+     * @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 void setValue(Boolean value) {
-        this.value = value.booleanValue();
+    public int compareTo(MutableBoolean other) {
+        boolean anotherVal = other.value;
+        return value == anotherVal ? 0 : (value ? 1 : -1);
     }
 
     //-----------------------------------------------------------------------

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableByte.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableByte.java?rev=830028&r1=830027&r2=830028&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableByte.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableByte.java Mon
Oct 26 23:50:31 2009
@@ -104,68 +104,6 @@
     }
 
     //-----------------------------------------------------------------------
-    // shortValue relies on Number implementation
-    /**
-     * Returns the value of this MutableByte as a byte.
-     *
-     * @return the numeric value represented by this object after conversion to type byte.
-     */
-    @Override
-    public byte byteValue() {
-        return value;
-    }
-
-    /**
-     * Returns the value of this MutableByte as an int.
-     *
-     * @return the numeric value represented by this object after conversion to type int.
-     */
-    @Override
-    public int intValue() {
-        return value;
-    }
-
-    /**
-     * Returns the value of this MutableByte as a long.
-     *
-     * @return the numeric value represented by this object after conversion to type long.
-     */
-    @Override
-    public long longValue() {
-        return value;
-    }
-
-    /**
-     * Returns the value of this MutableByte as a float.
-     *
-     * @return the numeric value represented by this object after conversion to type float.
-     */
-    @Override
-    public float floatValue() {
-        return value;
-    }
-
-    /**
-     * Returns the value of this MutableByte as a double.
-     *
-     * @return the numeric value represented by this object after conversion to type double.
-     */
-    @Override
-    public double doubleValue() {
-        return value;
-    }
-
-    //-----------------------------------------------------------------------
-    /**
-     * Gets this mutable as an instance of Byte.
-     *
-     * @return a Byte instance containing the value from this mutable
-     */
-    public Byte toByte() {
-        return Byte.valueOf(byteValue());
-    }
-
-    //-----------------------------------------------------------------------
     /**
      * Increments the value.
      *
@@ -228,6 +166,68 @@
     }
 
     //-----------------------------------------------------------------------
+    // shortValue relies on Number implementation
+    /**
+     * Returns the value of this MutableByte as a byte.
+     *
+     * @return the numeric value represented by this object after conversion to type byte.
+     */
+    @Override
+    public byte byteValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableByte as an int.
+     *
+     * @return the numeric value represented by this object after conversion to type int.
+     */
+    @Override
+    public int intValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableByte as a long.
+     *
+     * @return the numeric value represented by this object after conversion to type long.
+     */
+    @Override
+    public long longValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableByte as a float.
+     *
+     * @return the numeric value represented by this object after conversion to type float.
+     */
+    @Override
+    public float floatValue() {
+        return value;
+    }
+
+    /**
+     * Returns the value of this MutableByte as a double.
+     *
+     * @return the numeric value represented by this object after conversion to type double.
+     */
+    @Override
+    public double doubleValue() {
+        return value;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Gets this mutable as an instance of Byte.
+     *
+     * @return a Byte instance containing the value from this mutable
+     */
+    public Byte toByte() {
+        return Byte.valueOf(byteValue());
+    }
+
+    //-----------------------------------------------------------------------
     /**
      * 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

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableDouble.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableDouble.java?rev=830028&r1=830027&r2=830028&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableDouble.java
(original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableDouble.java
Mon Oct 26 23:50:31 2009
@@ -104,47 +104,6 @@
     }
 
     //-----------------------------------------------------------------------
-    // shortValue and bytValue rely on Number implementation
-    /**
-     * Returns the value of this MutableDouble as an int.
-     *
-     * @return the numeric value represented by this object after conversion to type int.
-     */
-    @Override
-    public int intValue() {
-        return (int) value;
-    }
-
-    /**
-     * Returns the value of this MutableDouble as a long.
-     *
-     * @return the numeric value represented by this object after conversion to type long.
-     */
-    @Override
-    public long longValue() {
-        return (long) value;
-    }
-
-    /**
-     * Returns the value of this MutableDouble as a float.
-     *
-     * @return the numeric value represented by this object after conversion to type float.
-     */
-    @Override
-    public float floatValue() {
-        return (float) value;
-    }
-
-    /**
-     * Returns the value of this MutableDouble as a double.
-     *
-     * @return the numeric value represented by this object after conversion to type double.
-     */
-    @Override
-    public double doubleValue() {
-        return value;
-    }
-
     /**
      * Checks whether the double value is the special NaN value.
      * 
@@ -165,16 +124,6 @@
 
     //-----------------------------------------------------------------------
     /**
-     * Gets this mutable as an instance of Double.
-     *
-     * @return a Double instance containing the value from this mutable, never null
-     */
-    public Double toDouble() {
-        return Double.valueOf(doubleValue());
-    }
-
-    //-----------------------------------------------------------------------
-    /**
      * Increments the value.
      *
      * @since Commons Lang 2.2
@@ -236,6 +185,58 @@
     }
 
     //-----------------------------------------------------------------------
+    // shortValue and bytValue rely on Number implementation
+    /**
+     * Returns the value of this MutableDouble as an int.
+     *
+     * @return the numeric value represented by this object after conversion to type int.
+     */
+    @Override
+    public int intValue() {
+        return (int) value;
+    }
+
+    /**
+     * Returns the value of this MutableDouble as a long.
+     *
+     * @return the numeric value represented by this object after conversion to type long.
+     */
+    @Override
+    public long longValue() {
+        return (long) value;
+    }
+
+    /**
+     * Returns the value of this MutableDouble as a float.
+     *
+     * @return the numeric value represented by this object after conversion to type float.
+     */
+    @Override
+    public float floatValue() {
+        return (float) value;
+    }
+
+    /**
+     * Returns the value of this MutableDouble as a double.
+     *
+     * @return the numeric value represented by this object after conversion to type double.
+     */
+    @Override
+    public double doubleValue() {
+        return value;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
+     * Gets this mutable as an instance of Double.
+     *
+     * @return a Double instance containing the value from this mutable, never null
+     */
+    public Double toDouble() {
+        return Double.valueOf(doubleValue());
+    }
+
+    //-----------------------------------------------------------------------
     /**
      * 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>Double</code> object
that represents a double that has the identical

Modified: commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableFloat.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableFloat.java?rev=830028&r1=830027&r2=830028&view=diff
==============================================================================
--- commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableFloat.java (original)
+++ commons/proper/lang/trunk/src/java/org/apache/commons/lang/mutable/MutableFloat.java Mon
Oct 26 23:50:31 2009
@@ -105,6 +105,25 @@
 
     //-----------------------------------------------------------------------
     /**
+     * Checks whether the float value is the special NaN value.
+     * 
+     * @return true if NaN
+     */
+    public boolean isNaN() {
+        return Float.isNaN(value);
+    }
+
+    /**
+     * Checks whether the float value is infinite.
+     * 
+     * @return true if infinite
+     */
+    public boolean isInfinite() {
+        return Float.isInfinite(value);
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Increments the value.
      *
      * @since Commons Lang 2.2
@@ -207,24 +226,6 @@
         return value;
     }
 
-    /**
-     * Checks whether the float value is the special NaN value.
-     * 
-     * @return true if NaN
-     */
-    public boolean isNaN() {
-        return Float.isNaN(value);
-    }
-
-    /**
-     * Checks whether the float value is infinite.
-     * 
-     * @return true if infinite
-     */
-    public boolean isInfinite() {
-        return Float.isInfinite(value);
-    }
-
     //-----------------------------------------------------------------------
     /**
      * Gets this mutable as an instance of Float.



Mime
View raw message