2007-07-20 03:18:25 +00:00
|
|
|
package java.lang;
|
|
|
|
|
|
|
|
public final class Boolean {
|
2007-07-28 16:55:24 +00:00
|
|
|
public static final Class TYPE = Class.forCanonicalName("Z");
|
2007-07-27 02:39:53 +00:00
|
|
|
|
2007-07-29 23:32:23 +00:00
|
|
|
public static final Boolean FALSE = new Boolean(false);
|
|
|
|
public static final Boolean TRUE = new Boolean(true);
|
|
|
|
|
2007-07-20 03:18:25 +00:00
|
|
|
private final boolean value;
|
|
|
|
|
|
|
|
public Boolean(boolean value) {
|
|
|
|
this.value = value;
|
|
|
|
}
|
|
|
|
|
2007-08-13 00:50:25 +00:00
|
|
|
public static Boolean valueOf(boolean value) {
|
|
|
|
return (value ? Boolean.TRUE : Boolean.FALSE);
|
|
|
|
}
|
|
|
|
|
2007-08-30 23:31:32 +00:00
|
|
|
public static Boolean valueOf(String s) {
|
|
|
|
return ("true".equals(s) ? Boolean.TRUE : Boolean.FALSE);
|
|
|
|
}
|
|
|
|
|
2007-07-29 23:32:23 +00:00
|
|
|
public boolean equals(Object o) {
|
|
|
|
return o instanceof Boolean && ((Boolean) o).value == value;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int hashCode() {
|
|
|
|
return (value ? 1 : 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public String toString() {
|
|
|
|
return toString(value);
|
|
|
|
}
|
|
|
|
|
|
|
|
public static String toString(boolean v) {
|
|
|
|
return (v ? "true" : "false");
|
|
|
|
}
|
|
|
|
|
2007-07-20 03:18:25 +00:00
|
|
|
public boolean booleanValue() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
}
|