1999-05-20 00:14:26 +00:00
|
|
|
class JSInteger extends JSNumber {
|
|
|
|
|
|
|
|
JSInteger(String s)
|
|
|
|
{
|
|
|
|
i = new Integer(s).intValue();
|
|
|
|
}
|
|
|
|
|
1999-05-20 21:16:11 +00:00
|
|
|
JSInteger(int p)
|
|
|
|
{
|
|
|
|
i = p;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
1999-05-26 01:01:07 +00:00
|
|
|
JSBoolean toJSBoolean(Environment theEnv) {
|
1999-05-20 21:16:11 +00:00
|
|
|
return (i != 0) ? JSBoolean.JSTrue : JSBoolean.JSFalse;
|
1999-05-20 00:14:26 +00:00
|
|
|
}
|
|
|
|
|
1999-05-26 01:01:07 +00:00
|
|
|
JSDouble toJSDouble(Environment theEnv) {
|
1999-05-20 21:16:11 +00:00
|
|
|
return new JSDouble(i);
|
|
|
|
}
|
|
|
|
|
1999-05-26 01:01:07 +00:00
|
|
|
JSInteger toJSInteger(Environment theEnv) {
|
1999-05-20 21:16:11 +00:00
|
|
|
return this;
|
|
|
|
}
|
|
|
|
|
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-20 21:16:11 +00:00
|
|
|
return new JSString(Integer.toString(i));
|
|
|
|
}
|
|
|
|
|
1999-05-28 19:00:48 +00:00
|
|
|
JSValue twiddle(Environment theEnv) {
|
|
|
|
return new JSInteger(~i);
|
1999-05-25 21:49:40 +00:00
|
|
|
}
|
|
|
|
|
1999-05-28 19:00:48 +00:00
|
|
|
JSValue and(Environment theEnv, JSValue rV) {
|
|
|
|
return new JSInteger(i & rV.toJSInteger(theEnv).i);
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
1999-05-28 19:00:48 +00:00
|
|
|
JSValue or(Environment theEnv, JSValue rV) {
|
|
|
|
return new JSInteger(i | rV.toJSInteger(theEnv).i);
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
1999-05-28 19:00:48 +00:00
|
|
|
JSValue xor(Environment theEnv, JSValue rV) {
|
|
|
|
return new JSInteger(i ^ rV.toJSInteger(theEnv).i);
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
1999-05-28 19:00:48 +00:00
|
|
|
JSValue shl(Environment theEnv, JSValue rV) {
|
|
|
|
return new JSInteger(i >> rV.toJSInteger(theEnv).i);
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
1999-05-28 19:00:48 +00:00
|
|
|
JSValue shr(Environment theEnv, JSValue rV) {
|
|
|
|
return new JSInteger(i << rV.toJSInteger(theEnv).i);
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
1999-05-28 19:00:48 +00:00
|
|
|
JSValue ushl(Environment theEnv, JSValue rV) {
|
|
|
|
return new JSInteger(i >>> rV.toJSInteger(theEnv).i);
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
1999-05-20 00:14:26 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
}
|