~ubuntu-branches/ubuntu/precise/classpath/precise

« back to all changes in this revision

Viewing changes to java/lang/Boolean.java

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch
  • Date: 2006-05-27 16:11:15 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20060527161115-h6e39eposdt5snb6
Tags: 2:0.91-3
* Install header files to /usr/include/classpath.
* debian/control: classpath: Conflict with jamvm < 1.4.3 and
  cacao < 0.96 (Closes: #368172).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Boolean.java -- object wrapper for boolean
2
 
   Copyright (C) 1998, 2001, 2002, 2005  Free Software Foundation, Inc.
 
2
   Copyright (C) 1998, 2001, 2002, 2005, 2006  Free Software Foundation, Inc.
3
3
 
4
4
This file is part of GNU Classpath.
5
5
 
47
47
 * @author Paul Fisher
48
48
 * @author Eric Blake (ebb9@email.byu.edu)
49
49
 * @since 1.0
50
 
 * @status updated to 1.4
 
50
 * @status updated to 1.5
51
51
 */
52
 
public final class Boolean implements Serializable
 
52
public final class Boolean implements Serializable, Comparable
53
53
{
54
54
  /**
55
55
   * Compatible with JDK 1.0.2+.
223
223
  }
224
224
 
225
225
  /**
 
226
   * Compares this Boolean to another.
 
227
   *
 
228
   * @param other the Boolean to compare this Boolean to
 
229
   * @return 0 if both Booleans represent the same value, a positive number 
 
230
   * if this Boolean represents true and the other false, and a negative
 
231
   * number otherwise.
 
232
   * @since 1.5
 
233
   */
 
234
  public int compareTo(Boolean other)
 
235
  {
 
236
    return value == other.value ? 0 : (value ? 1 : -1);
 
237
  }
 
238
 
 
239
  /**
 
240
   * Bridge method
 
241
   */
 
242
  public int compareTo(Object other)
 
243
  {
 
244
    return compareTo((Boolean)other);
 
245
  }
 
246
 
 
247
  /**
226
248
   * If the String argument is "true", ignoring case, return true.
227
249
   * Otherwise, return false.
228
250
   *
233
255
  {
234
256
    return "true".equalsIgnoreCase(b) ? true : false;
235
257
  }
 
258
 
236
259
}