diff options
author | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-15 23:20:01 +0000 |
---|---|---|
committer | mark <mark@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-11-15 23:20:01 +0000 |
commit | 3b3101d8b5ae4f08a16c0b7111da6cad41bbd282 (patch) | |
tree | a5eb7cf42a51869cc8aa1fad7ad6a90cca47fdd8 /libjava/classpath/java/lang/Boolean.java | |
parent | 7e55c49d7d91ef9f09e93c1100119b1ab3652446 (diff) | |
download | gcc-3b3101d8b5ae4f08a16c0b7111da6cad41bbd282.tar.gz |
Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated.
* Makefile.in: Likewise.
* scripts/makemake.tcl: Use glob -nocomplain.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@107049 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/lang/Boolean.java')
-rw-r--r-- | libjava/classpath/java/lang/Boolean.java | 32 |
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; + } } |