1 |
/* Boolean.java -- object wrapper for boolean |
/* Boolean.java -- object wrapper for boolean |
2 |
Copyright (C) 1998, 2001, 2002 Free Software Foundation, Inc. |
Copyright (C) 1998, 2001, 2002, 2004 Free Software Foundation, Inc. |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
49 |
* @since 1.0 |
* @since 1.0 |
50 |
* @status updated to 1.4 |
* @status updated to 1.4 |
51 |
*/ |
*/ |
52 |
public final class Boolean implements Serializable |
public final class Boolean implements Serializable, Comparable<Boolean> |
53 |
{ |
{ |
54 |
/** |
/** |
55 |
* Compatible with JDK 1.0.2+. |
* Compatible with JDK 1.0.2+. |
221 |
return false; |
return false; |
222 |
return "true".equalsIgnoreCase(System.getProperty(name)); |
return "true".equalsIgnoreCase(System.getProperty(name)); |
223 |
} |
} |
224 |
|
|
225 |
|
/** |
226 |
|
* If the String argument is "true", ignoring case, return true. |
227 |
|
* Otherwise, return false. |
228 |
|
* |
229 |
|
* @param b String to parse |
230 |
|
* @since 1.5 |
231 |
|
*/ |
232 |
|
public static boolean parseBoolean(String b) |
233 |
|
{ |
234 |
|
return "true".equalsIgnoreCase(b) ? true : false; |
235 |
|
} |
236 |
|
|
237 |
|
/** |
238 |
|
* This implements the comparison contract specified by Comparable. |
239 |
|
* @see Comparable |
240 |
|
* @since 1.5 |
241 |
|
*/ |
242 |
|
public int compareTo(Boolean other) |
243 |
|
{ |
244 |
|
return value == other.value ? 0 : (value ? 1 : -1); |
245 |
|
} |
246 |
} |
} |