public static double toInteger(Object[] args, int index) { return (index < args.length) ? toInteger(args[index]) : +0.0; }
public static double toInteger(Object[] args, int index) { return (index < args.length) ? toInteger(args[index]) : +0.0; }
public static double toInteger(Object[] args, int index) { return (index < args.length) ? toInteger(args[index]) : +0.0; }
public static double toInteger(Object[] args, int index) { return (index < args.length) ? toInteger(args[index]) : +0.0; }
public static double toInteger(Object[] args, int index) { return (index < args.length) ? toInteger(args[index]) : +0.0; }
public static double toInteger(Object[] args, int index) { return (index < args.length) ? toInteger(args[index]) : +0.0; }
/** * * See ECMA 9.4. */ public static double toInteger(Object val) { return toInteger(toNumber(val)); }
private static int js_indexOf(String target, Object[] args) { String search = ScriptRuntime.toString(args, 0); double begin = ScriptRuntime.toInteger(args, 1); if (begin > target.length()) { return -1; } else { if (begin < 0) begin = 0; return target.indexOf(search, (int)begin); } }
private static int js_indexOf(String target, Object[] args) { String search = ScriptRuntime.toString(args, 0); double begin = ScriptRuntime.toInteger(args, 1); if (begin > target.length()) { return -1; } else { if (begin < 0) begin = 0; return target.indexOf(search, (int)begin); } }
/** * * See ECMA 9.4. */ public static double toInteger(Object val) { return toInteger(toNumber(val)); }
/** * * See ECMA 9.4. */ public static double toInteger(Object val) { return toInteger(toNumber(val)); }
private static int js_indexOf(String target, Object[] args) { String search = ScriptRuntime.toString(args, 0); double begin = ScriptRuntime.toInteger(args, 1); if (begin > target.length()) { return -1; } else { if (begin < 0) begin = 0; return target.indexOf(search, (int)begin); } }
private static int js_indexOf(String target, Object[] args) { String search = ScriptRuntime.toString(args, 0); double begin = ScriptRuntime.toInteger(args, 1); if (begin > target.length()) { return -1; } else { if (begin < 0) begin = 0; return target.indexOf(search, (int)begin); } }
/** * * See ECMA 9.4. */ public static double toInteger(Object val) { return toInteger(toNumber(val)); }
private static int js_indexOf(String target, Object[] args) { String search = ScriptRuntime.toString(args, 0); double begin = ScriptRuntime.toInteger(args, 1); if (begin > target.length()) { return -1; } else { if (begin < 0) begin = 0; return target.indexOf(search, (int)begin); } }
/** * * See ECMA 9.4. */ public static double toInteger(Object val) { return toInteger(toNumber(val)); }
/** * * See ECMA 9.4. */ public static double toInteger(Object val) { return toInteger(toNumber(val)); }
private static int js_indexOf(int methodId, String target, Object[] args) { String searchStr = ScriptRuntime.toString(args, 0); double position = ScriptRuntime.toInteger(args, 1); if (position > target.length() && methodId != Id_startsWith && methodId != Id_endsWith) { return -1; } else { if (position < 0) position = 0; else if (position > target.length()) position = target.length(); else if (methodId == Id_endsWith && (position != position || position > target.length())) position = target.length(); if (Id_endsWith == methodId) { if (args.length == 0 || args.length == 1 || (args.length == 2 && args[1] == Undefined.instance)) position = target.length(); return target.substring(0, (int)position).endsWith(searchStr) ? 0 : -1; } return methodId == Id_startsWith ? target.startsWith(searchStr, (int)position) ? 0 : -1 : target.indexOf(searchStr, (int)position); } }
private static double date_msecFromArgs(Object[] args) { double array[] = new double[MAXARGS]; int loop; double d; for (loop = 0; loop < MAXARGS; loop++) { if (loop < args.length) { d = ScriptRuntime.toNumber(args[loop]); if (d != d || Double.isInfinite(d)) { return ScriptRuntime.NaN; } array[loop] = ScriptRuntime.toInteger(args[loop]); } else { if (loop == 2) { array[loop] = 1; /* Default the date argument to 1. */ } else { array[loop] = 0; } } } /* adjust 2-digit years into the 20th century */ if (array[0] >= 0 && array[0] <= 99) array[0] += 1900; return date_msecFromDate(array[0], array[1], array[2], array[3], array[4], array[5], array[6]); }
private Scriptable js_slice(Context cx, Scriptable thisObj, Object[] args) { Scriptable scope = getTopLevelScope(this); Scriptable result = ScriptRuntime.newObject(cx, scope, "Array", null); long length = getLengthProperty(cx, thisObj); long begin, end; if (args.length == 0) { begin = 0; end = length; } else { begin = toSliceIndex(ScriptRuntime.toInteger(args[0]), length); if (args.length == 1) { end = length; } else { end = toSliceIndex(ScriptRuntime.toInteger(args[1]), length); } } for (long slot = begin; slot < end; slot++) { Object temp = getElem(cx, thisObj, slot); setElem(cx, result, slot - begin, temp); } return result; }