commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nia...@apache.org
Subject svn commit: r905153 - in /commons/proper/lang/branches/LANG_2_X/src: main/java/org/apache/commons/lang/mutable/MutableBoolean.java test/java/org/apache/commons/lang/mutable/MutableBooleanTest.java
Date Mon, 01 Feb 2010 00:21:30 GMT
Author: niallp
Date: Mon Feb  1 00:21:30 2010
New Revision: 905153

URL: http://svn.apache.org/viewvc?rev=905153&view=rev
Log:
Port r830029 to 2.x branch - add isTrue() and isFalse() methods to MutableBoolean

Modified:
    commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/mutable/MutableBoolean.java
    commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/mutable/MutableBooleanTest.java

Modified: commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/mutable/MutableBoolean.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/mutable/MutableBoolean.java?rev=905153&r1=905152&r2=905153&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/mutable/MutableBoolean.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/main/java/org/apache/commons/lang/mutable/MutableBoolean.java
Mon Feb  1 00:21:30 2010
@@ -100,6 +100,25 @@
 
     //-----------------------------------------------------------------------
     /**
+     * Checks if the current value is <code>true</code>.
+     * 
+     * @return <code>true</code> if the current value is <code>true</code>
+     */
+    public boolean isTrue() {
+        return value == true;
+    }
+
+    /**
+     * Checks if the current value is <code>false</code>.
+     * 
+     * @return <code>true</code> if the current value is <code>false</code>
+     */
+    public boolean isFalse() {
+        return value == false;
+    }
+
+    //-----------------------------------------------------------------------
+    /**
      * Returns the value of this MutableBoolean as a boolean.
      * 
      * @return the boolean value represented by this object.

Modified: commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/mutable/MutableBooleanTest.java
URL: http://svn.apache.org/viewvc/commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/mutable/MutableBooleanTest.java?rev=905153&r1=905152&r2=905153&view=diff
==============================================================================
--- commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/mutable/MutableBooleanTest.java
(original)
+++ commons/proper/lang/branches/LANG_2_X/src/test/java/org/apache/commons/lang/mutable/MutableBooleanTest.java
Mon Feb  1 00:21:30 2010
@@ -111,10 +111,14 @@
         final MutableBoolean mutBool = new MutableBoolean(false);
         assertEquals(Boolean.FALSE, mutBool.toBoolean());
         assertEquals(false, mutBool.booleanValue());
+        assertEquals(true, mutBool.isFalse());
+        assertEquals(false, mutBool.isTrue());
 
         mutBool.setValue(Boolean.TRUE);
         assertEquals(Boolean.TRUE, mutBool.toBoolean());
         assertEquals(true, mutBool.booleanValue());
+        assertEquals(false, mutBool.isFalse());
+        assertEquals(true, mutBool.isTrue());
 
         mutBool.setValue(false);
         assertEquals(false, mutBool.booleanValue());



Mime
View raw message