1999-05-20 00:14:26 +00:00
|
|
|
class JSBoolean extends JSValue {
|
1999-05-20 21:16:11 +00:00
|
|
|
|
|
|
|
static JSBoolean JSTrue = new JSBoolean(true);
|
|
|
|
static JSBoolean JSFalse = new JSBoolean(false);
|
|
|
|
|
|
|
|
private JSBoolean(boolean p)
|
1999-05-20 00:14:26 +00:00
|
|
|
{
|
1999-05-20 21:16:11 +00:00
|
|
|
b = p;
|
1999-05-20 00:14:26 +00:00
|
|
|
}
|
|
|
|
|
1999-05-28 19:00:48 +00:00
|
|
|
JSValue eval(Environment theEnv)
|
1999-05-20 00:14:26 +00:00
|
|
|
{
|
1999-05-28 19:00:48 +00:00
|
|
|
return this;
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
boolean isTrue()
|
|
|
|
{
|
|
|
|
return b;
|
|
|
|
}
|
|
|
|
|
|
|
|
boolean isFalse()
|
|
|
|
{
|
|
|
|
return !b;
|
|
|
|
}
|
|
|
|
|
1999-05-28 19:00:48 +00:00
|
|
|
JSValue bang(Environment theEnv) {
|
|
|
|
return (b) ? JSFalse : JSTrue;
|
1999-05-25 21:49:40 +00:00
|
|
|
}
|
|
|
|
|
1999-05-28 19:00:48 +00:00
|
|
|
JSValue typeof(Environment theEnv) {
|
|
|
|
return new JSString("boolean");
|
1999-05-25 21:49:40 +00:00
|
|
|
}
|
|
|
|
|
1999-05-26 01:01:07 +00:00
|
|
|
JSBoolean toJSBoolean(Environment theEnv) {
|
1999-05-20 21:16:11 +00:00
|
|
|
return this;
|
1999-05-20 00:14:26 +00:00
|
|
|
}
|
|
|
|
|
1999-05-26 01:01:07 +00:00
|
|
|
JSValue toPrimitive(Environment theEnv, String hint) {
|
1999-05-21 00:54:26 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
1999-05-26 01:01:07 +00:00
|
|
|
JSString toJSString(Environment theEnv) {
|
1999-05-21 00:54:26 +00:00
|
|
|
return (b) ? new JSString("true") : new JSString("false");
|
|
|
|
}
|
|
|
|
|
1999-05-26 01:01:07 +00:00
|
|
|
JSDouble toJSDouble(Environment theEnv) {
|
1999-05-21 00:54:26 +00:00
|
|
|
return (b) ? new JSDouble(1) : new JSDouble(0);
|
|
|
|
}
|
1999-05-20 21:16:11 +00:00
|
|
|
|
1999-05-20 00:14:26 +00:00
|
|
|
boolean b;
|
|
|
|
|
|
|
|
}
|