2007-07-19 21:18:25 -06:00
|
|
|
package java.lang;
|
|
|
|
|
|
|
|
public final class Boolean {
|
2007-07-28 10:55:24 -06:00
|
|
|
public static final Class TYPE = Class.forCanonicalName("Z");
|
2007-07-26 20:39:53 -06:00
|
|
|
|
2007-07-29 17:32:23 -06:00
|
|
|
public static final Boolean FALSE = new Boolean(false);
|
|
|
|
public static final Boolean TRUE = new Boolean(true);
|
|
|
|
|
2007-07-19 21:18:25 -06:00
|
|
|
private final boolean value;
|
|
|
|
|
|
|
|
public Boolean(boolean value) {
|
|
|
|
this.value = value;
|
|
|
|
}
|
|
|
|
|
2007-09-13 20:19:44 -06:00
|
|
|
public Boolean(String s) {
|
|
|
|
this.value = "true".equals(s);
|
|
|
|
}
|
|
|
|
|
2007-08-12 18:50:25 -06:00
|
|
|
public static Boolean valueOf(boolean value) {
|
|
|
|
return (value ? Boolean.TRUE : Boolean.FALSE);
|
|
|
|
}
|
|
|
|
|
2007-08-30 17:31:32 -06:00
|
|
|
public static Boolean valueOf(String s) {
|
|
|
|
return ("true".equals(s) ? Boolean.TRUE : Boolean.FALSE);
|
|
|
|
}
|
|
|
|
|
2007-07-29 17:32:23 -06: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-19 21:18:25 -06:00
|
|
|
public boolean booleanValue() {
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
}
|