public Object call(Scope scope, Object a, Object extra[]) { Object def = 0; if (extra != null && extra.length > 0) def = extra[0]; if (scope.getThis() instanceof JSNumber) { JSNumber n = (JSNumber) (scope.getThis()); n._val = _parse(a, def); return n._val; } return _parse(a, def); }
public Object call(Scope sc, Object pointsInt, Object fo00000o[]) { Number n = (Number) (sc.getThis()); int num = 0; if (pointsInt != null && pointsInt instanceof Number) num = ((Number) pointsInt).intValue(); double mult = Math.pow(10, num); long foo = Math.round(n.doubleValue() * mult); double d = foo; d = d / mult; String s = String.valueOf(d); int idx = s.indexOf("."); if (idx < 0) { if (num > 0) { s += "."; while (num > 0) { s += "0"; num--; } } return new JSString(s); } if (s.length() - idx <= num) { // need more int toAdd = (num + 1) - (s.length() - idx); for (int i = 0; i < toAdd; i++) s += "0"; return new JSString(s); } if (num == 0) return s.substring(0, idx); return new JSString(s.substring(0, idx + 1 + num)); }
public Object call(Scope s, Object foo[]) { Number n = (Number) s.getThis(); return n.doubleValue() * _conversion; }