summaryrefslogtreecommitdiff
path: root/libjava/classpath/java/lang/Boolean.java
diff options
context:
space:
mode:
authorMark Wielaard <mark@gcc.gnu.org>2005-11-15 23:20:01 +0000
committerMark Wielaard <mark@gcc.gnu.org>2005-11-15 23:20:01 +0000
commit8f523f3a1047919d3563daf1ef47ba87336ebe89 (patch)
treea5eb7cf42a51869cc8aa1fad7ad6a90cca47fdd8 /libjava/classpath/java/lang/Boolean.java
parent02e549bfaaec38f68307e7f34e46ea57ea1809af (diff)
Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated. * Makefile.in: Likewise. * scripts/makemake.tcl: Use glob -nocomplain. From-SVN: r107049
Diffstat (limited to 'libjava/classpath/java/lang/Boolean.java')
-rw-r--r--libjava/classpath/java/lang/Boolean.java32
1 files changed, 32 insertions, 0 deletions
diff --git a/libjava/classpath/java/lang/Boolean.java b/libjava/classpath/java/lang/Boolean.java
index b6910280e6b..902c93b3186 100644
--- a/libjava/classpath/java/lang/Boolean.java
+++ b/libjava/classpath/java/lang/Boolean.java
@@ -221,4 +221,36 @@ public final class Boolean implements Serializable
return false;
return "true".equalsIgnoreCase(System.getProperty(name));
}
+
+ /**
+ * If the String argument is "true", ignoring case, return true.
+ * Otherwise, return false.
+ *
+ * @param b String to parse
+ * @since 1.5
+ */
+ public static boolean parseBoolean(String b)
+ {
+ return "true".equalsIgnoreCase(b) ? true : false;
+ }
+
+ /**
+ * Compares this Boolean to another.
+ * @param b the Boolean to compare this Boolean to
+ * @return 0 if both Booleans represent the same value, a positive number
+ * if this Boolean represents true and b represents false, or a negative
+ * number otherwise.
+ * @since 1.5
+ */
+ public int compareTo (Boolean b)
+ {
+ if (b == null)
+ throw new NullPointerException("argument passed to compareTo(Boolean) cannot be null");
+
+ if (this.value == b.value)
+ return 0;
+ if (this.value == true)
+ return 1;
+ return -1;
+ }
}