private static final JS SQRT1_2 = JS.N(1/java.lang.Math.sqrt(2));
private static final JS SQRT2 = JS.N(java.lang.Math.sqrt(2));
- public JS callMethod(JS method_, JS a0, JS a1, JS a2, JS[] rest, int nargs) throws JSExn {
- if(!JS.isString(method_)) return super.callMethod(method_,a0,a1,a2,rest,nargs);
- String method = JS.toString(method_);
+ public JS callMethod(JS method, JS a0, JS a1, JS a2, JS[] rest, int nargs) throws JSExn {
switch(nargs) {
case 0: {
- //#switch(method)
+ //#jswitch(method)
case "random": return JS.N(java.lang.Math.random());
//#end
break;
}
case 1: {
- //#switch(method)
+ //#jswitch(method)
case "ceil": return JS.N((long)java.lang.Math.ceil(toDouble(a0)));
case "floor": return JS.N((long)java.lang.Math.floor(toDouble(a0)));
case "round": return JS.N((long)java.lang.Math.round(toDouble(a0)));
break;
}
case 2: {
- //#switch(method)
+ //#jswitch(method)
case "min": return JS.N(java.lang.Math.min(toDouble(a0), toDouble(a1)));
case "max": return JS.N(java.lang.Math.max(toDouble(a0), toDouble(a1)));
case "pow": return JS.N(java.lang.Math.pow(toDouble(a0), toDouble(a1)));
break;
}
}
- return super.callMethod(method_, a0, a1, a2, rest, nargs);
+ return super.callMethod(method, a0, a1, a2, rest, nargs);
}
- public JS get(JS key_) throws JSExn {
- if(!JS.isString(key_)) return super.get(key_);
- String key = JS.toString(key_);
- //#switch(key)
+ public JS get(JS key) throws JSExn {
+ //#jswitch(key)
case "E": return E;
case "LN10": return LN10;
case "LN2": return LN2;
case "log": return METHOD;
case "random": return METHOD;
//#end
- return super.get(key_);
+ return super.get(key);
}
}