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-20 00:14:26 +00:00
|
|
|
void eval(Environment theEnv)
|
|
|
|
{
|
1999-05-20 21:16:11 +00:00
|
|
|
theEnv.theStack.push(this);
|
|
|
|
}
|
|
|
|
|
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-25 21:49:40 +00:00
|
|
|
void twiddle(Environment theEnv) {
|
|
|
|
theEnv.theStack.push(new JSInteger(~i));
|
|
|
|
}
|
|
|
|
|
1999-05-20 21:16:11 +00:00
|
|
|
void and(Environment theEnv) {
|
|
|
|
JSValue vR = theEnv.theStack.pop();
|
1999-05-26 01:01:07 +00:00
|
|
|
theEnv.theStack.push(new JSInteger(i & vR.toJSInteger(theEnv).i));
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void or(Environment theEnv) {
|
|
|
|
JSValue vR = theEnv.theStack.pop();
|
1999-05-26 01:01:07 +00:00
|
|
|
theEnv.theStack.push(new JSInteger(i | vR.toJSInteger(theEnv).i));
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void xor(Environment theEnv) {
|
|
|
|
JSValue vR = theEnv.theStack.pop();
|
1999-05-26 01:01:07 +00:00
|
|
|
theEnv.theStack.push(new JSInteger(i ^ vR.toJSInteger(theEnv).i));
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void shl(Environment theEnv) {
|
|
|
|
JSValue vR = theEnv.theStack.pop();
|
1999-05-26 01:01:07 +00:00
|
|
|
theEnv.theStack.push(new JSInteger(i >> vR.toJSInteger(theEnv).i));
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void shr(Environment theEnv) {
|
|
|
|
JSValue vR = theEnv.theStack.pop();
|
1999-05-26 01:01:07 +00:00
|
|
|
theEnv.theStack.push(new JSInteger(i << vR.toJSInteger(theEnv).i));
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ushl(Environment theEnv) {
|
|
|
|
JSValue vR = theEnv.theStack.pop();
|
1999-05-26 01:01:07 +00:00
|
|
|
theEnv.theStack.push(new JSInteger(i >>> vR.toJSInteger(theEnv).i));
|
1999-05-20 21:16:11 +00:00
|
|
|
}
|
|
|
|
|
1999-05-20 00:14:26 +00:00
|
|
|
int i;
|
|
|
|
|
|
|
|
}
|