/** * Convert the value to a JavaScript boolean value. * <p> * See ECMA 9.2. * * @param value a JavaScript value * @return the corresponding boolean value converted using * the ECMA rules */ public static boolean toBoolean(Object value) { return ScriptRuntime.toBoolean(value); }
/** * Convert the value to a JavaScript boolean value. * <p> * See ECMA 9.2. * * @param value a JavaScript value * @return the corresponding boolean value converted using * the ECMA rules */ public static boolean toBoolean(Object value) { return ScriptRuntime.toBoolean(value); }
/** * Convert the value to a JavaScript boolean value. * <p> * See ECMA 9.2. * * @param value a JavaScript value * @return the corresponding boolean value converted using * the ECMA rules */ public static boolean toBoolean(Object value) { return ScriptRuntime.toBoolean(value); }
/** * Convert the value to a JavaScript boolean value. * <p> * See ECMA 9.2. * * @param value a JavaScript value * @return the corresponding boolean value converted using * the ECMA rules */ public static boolean toBoolean(Object value) { return ScriptRuntime.toBoolean(value); }
protected static boolean isTrue(Object value) { return (value != NOT_FOUND) && ScriptRuntime.toBoolean(value); }
/** * Convert the value to a JavaScript boolean value. * <p> * See ECMA 9.2. * * @param value a JavaScript value * @return the corresponding boolean value converted using * the ECMA rules */ public static boolean toBoolean(Object value) { return ScriptRuntime.toBoolean(value); }
/** * Convert the value to a JavaScript boolean value. * <p> * See ECMA 9.2. * * @param value a JavaScript value * @return the corresponding boolean value converted using * the ECMA rules */ public static boolean toBoolean(Object value) { return ScriptRuntime.toBoolean(value); }
public static boolean toBoolean(Object[] args, int index) { return (index < args.length) ? toBoolean(args[index]) : false; }
protected static boolean isTrue(Object value) { return (value != NOT_FOUND) && ScriptRuntime.toBoolean(value); }
protected static boolean isTrue(Object value) { return (value != NOT_FOUND) && ScriptRuntime.toBoolean(value); }
protected static boolean isTrue(Object value) { return (value != NOT_FOUND) && ScriptRuntime.toBoolean(value); }
protected int applyDescriptorToAttributeBitset(int attributes, ScriptableObject desc) { Object enumerable = getProperty(desc, "enumerable"); if (enumerable != NOT_FOUND) { attributes = ScriptRuntime.toBoolean(enumerable) ? attributes & ~DONTENUM : attributes | DONTENUM; } Object writable = getProperty(desc, "writable"); if (writable != NOT_FOUND) { attributes = ScriptRuntime.toBoolean(writable) ? attributes & ~READONLY : attributes | READONLY; } Object configurable = getProperty(desc, "configurable"); if (configurable != NOT_FOUND) { attributes = ScriptRuntime.toBoolean(configurable) ? attributes & ~PERMANENT : attributes | PERMANENT; } return attributes; }
private Object isNaN(Number val) { Double nd = doubleVal(val); return ScriptRuntime.toBoolean(isDoubleNan(nd)); }
private boolean isSafeInteger(Number val) { Double nd = doubleVal(val); return ScriptRuntime.toBoolean(isDoubleSafeInteger(nd)); }
private boolean isInteger(Number val) { Double nd = doubleVal(val); return ScriptRuntime.toBoolean(isDoubleInteger(nd)); }
protected void setInstanceIdValue(int id, Object value) { switch (id - super.getMaxInstanceId()) { case Id_ignoreComments: options.setIgnoreComments(ScriptRuntime.toBoolean(value)); return; case Id_ignoreProcessingInstructions: options.setIgnoreProcessingInstructions(ScriptRuntime.toBoolean(value)); return; case Id_ignoreWhitespace: options.setIgnoreWhitespace(ScriptRuntime.toBoolean(value)); return; case Id_prettyIndent: options.setPrettyIndent(ScriptRuntime.toInt32(value)); return; case Id_prettyPrinting: options.setPrettyPrinting(ScriptRuntime.toBoolean(value)); return; } super.setInstanceIdValue(id, value); }
private Object js_getFloat(int bytes, Object[] args) { checkOffset(args, 0); int offset = ScriptRuntime.toInt32(args[0]); rangeCheck(offset, bytes); boolean littleEndian = (isArg(args, 1) && (bytes > 1) && ScriptRuntime.toBoolean(args[1])); switch (bytes) { case 4: return ByteIo.readFloat32(arrayBuffer.buffer, offset, littleEndian); case 8: return ByteIo.readFloat64(arrayBuffer.buffer, offset, littleEndian); default: throw new AssertionError(); } }
@Override protected void setInstanceIdValue(int id, Object value) { int shifted = id - super.getMaxInstanceId(); switch (shifted) { case Id_multiline: case Id_STAR: getImpl().multiline = ScriptRuntime.toBoolean(value); return; case Id_input: case Id_UNDERSCORE: getImpl().input = ScriptRuntime.toString(value); return; } super.setInstanceIdValue(id, value); }
protected void setInstanceIdValue(int id, Object value) { int shifted = id - super.getMaxInstanceId(); switch (shifted) { case Id_multiline: case Id_STAR: getImpl().multiline = ScriptRuntime.toBoolean(value); return; case Id_input: case Id_UNDERSCORE: getImpl().input = ScriptRuntime.toString(value); return; } super.setInstanceIdValue(id, value); }
private void js_setFloat(int bytes, Object[] args) { checkOffset(args, 0); checkValue(args, 1); int offset = ScriptRuntime.toInt32(args[0]); rangeCheck(offset, bytes); boolean littleEndian = (isArg(args, 2) && (bytes > 1) && ScriptRuntime.toBoolean(args[2])); double val = ScriptRuntime.toNumber(args[1]); switch (bytes) { case 4: ByteIo.writeFloat32(arrayBuffer.buffer, offset, val, littleEndian); break; case 8: ByteIo.writeFloat64(arrayBuffer.buffer, offset, val, littleEndian); break; default: throw new AssertionError(); } }