From 3b3101d8b5ae4f08a16c0b7111da6cad41bbd282 Mon Sep 17 00:00:00 2001 From: mark Date: Tue, 15 Nov 2005 23:20:01 +0000 Subject: 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 --- libjava/classpath/java/lang/Boolean.java | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'libjava/classpath/java/lang/Boolean.java') 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; + } } -- cgit v1.2.3