Java Code Examples for jdk.nashorn.internal.runtime.ScriptRuntime#EQ_STRICT
The following examples show how to use
jdk.nashorn.internal.runtime.ScriptRuntime#EQ_STRICT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NativeArray.java From nashorn with GNU General Public License v2.0 | 6 votes |
/** * ECMA 15.4.4.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param searchElement element to search for * @param fromIndex start index of search * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static Object indexOf(final Object self, final Object searchElement, final Object fromIndex) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); final long n = JSType.toLong(fromIndex); if (len == 0 || n >= len) { return -1; } for (long k = Math.max(0, (n < 0) ? (len - Math.abs(n)) : n); k < len; k++) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { //fallthru } return -1; }
Example 2
Source File: NativeArray.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param searchElement element to search for * @param fromIndex start index of search * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static double indexOf(final Object self, final Object searchElement, final Object fromIndex) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final long n = JSType.toLong(fromIndex); if (n >= len) { return -1; } for (long k = Math.max(0, n < 0 ? len - Math.abs(n) : n); k < len; k++) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { //fallthru } return -1; }
Example 3
Source File: NativeArray.java From nashorn with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param args arguments: element to search for and optional from index * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static Object lastIndexOf(final Object self, final Object... args) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final Object searchElement = (args.length > 0) ? args[0] : ScriptRuntime.UNDEFINED; final long n = (args.length > 1) ? JSType.toLong(args[1]) : (len - 1); for (long k = (n < 0) ? (len - Math.abs(n)) : Math.min(n, len - 1); k >= 0; k--) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { throw typeError("not.an.object", ScriptRuntime.safeToString(self)); } return -1; }
Example 4
Source File: NativeArray.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param args arguments: element to search for and optional from index * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static double lastIndexOf(final Object self, final Object... args) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final Object searchElement = args.length > 0 ? args[0] : ScriptRuntime.UNDEFINED; final long n = args.length > 1 ? JSType.toLong(args[1]) : len - 1; for (long k = n < 0 ? len - Math.abs(n) : Math.min(n, len - 1); k >= 0; k--) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { throw typeError("not.an.object", ScriptRuntime.safeToString(self)); } return -1; }
Example 5
Source File: NativeArray.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param searchElement element to search for * @param fromIndex start index of search * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static double indexOf(final Object self, final Object searchElement, final Object fromIndex) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final long n = JSType.toLong(fromIndex); if (n >= len) { return -1; } for (long k = Math.max(0, n < 0 ? len - Math.abs(n) : n); k < len; k++) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { //fallthru } return -1; }
Example 6
Source File: NativeArray.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param args arguments: element to search for and optional from index * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static Object lastIndexOf(final Object self, final Object... args) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final Object searchElement = (args.length > 0) ? args[0] : ScriptRuntime.UNDEFINED; final long n = (args.length > 1) ? JSType.toLong(args[1]) : (len - 1); for (long k = (n < 0) ? (len - Math.abs(n)) : Math.min(n, len - 1); k >= 0; k--) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { throw typeError("not.an.object", ScriptRuntime.safeToString(self)); } return -1; }
Example 7
Source File: NativeArray.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param searchElement element to search for * @param fromIndex start index of search * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static Object indexOf(final Object self, final Object searchElement, final Object fromIndex) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final long n = JSType.toLong(fromIndex); if (n >= len) { return -1; } for (long k = Math.max(0, (n < 0) ? (len - Math.abs(n)) : n); k < len; k++) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { //fallthru } return -1; }
Example 8
Source File: NativeArray.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param args arguments: element to search for and optional from index * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static Object lastIndexOf(final Object self, final Object... args) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final Object searchElement = (args.length > 0) ? args[0] : ScriptRuntime.UNDEFINED; final long n = (args.length > 1) ? JSType.toLong(args[1]) : (len - 1); for (long k = (n < 0) ? (len - Math.abs(n)) : Math.min(n, len - 1); k >= 0; k--) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { throw typeError("not.an.object", ScriptRuntime.safeToString(self)); } return -1; }
Example 9
Source File: NativeArray.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param searchElement element to search for * @param fromIndex start index of search * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static Object indexOf(final Object self, final Object searchElement, final Object fromIndex) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final long n = JSType.toLong(fromIndex); if (n >= len) { return -1; } for (long k = Math.max(0, (n < 0) ? (len - Math.abs(n)) : n); k < len; k++) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { //fallthru } return -1; }
Example 10
Source File: NativeArray.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param args arguments: element to search for and optional from index * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static double lastIndexOf(final Object self, final Object... args) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final Object searchElement = args.length > 0 ? args[0] : ScriptRuntime.UNDEFINED; final long n = args.length > 1 ? JSType.toLong(args[1]) : len - 1; for (long k = n < 0 ? len - Math.abs(n) : Math.min(n, len - 1); k >= 0; k--) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { throw typeError("not.an.object", ScriptRuntime.safeToString(self)); } return -1; }
Example 11
Source File: NativeArray.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param searchElement element to search for * @param fromIndex start index of search * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static double indexOf(final Object self, final Object searchElement, final Object fromIndex) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final long n = JSType.toLong(fromIndex); if (n >= len) { return -1; } for (long k = Math.max(0, n < 0 ? len - Math.abs(n) : n); k < len; k++) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { //fallthru } return -1; }
Example 12
Source File: NativeArray.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param args arguments: element to search for and optional from index * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static double lastIndexOf(final Object self, final Object... args) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final Object searchElement = args.length > 0 ? args[0] : ScriptRuntime.UNDEFINED; final long n = args.length > 1 ? JSType.toLong(args[1]) : len - 1; for (long k = n < 0 ? len - Math.abs(n) : Math.min(n, len - 1); k >= 0; k--) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { throw typeError("not.an.object", ScriptRuntime.safeToString(self)); } return -1; }
Example 13
Source File: NativeArray.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param searchElement element to search for * @param fromIndex start index of search * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static double indexOf(final Object self, final Object searchElement, final Object fromIndex) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final long n = JSType.toLong(fromIndex); if (n >= len) { return -1; } for (long k = Math.max(0, n < 0 ? len - Math.abs(n) : n); k < len; k++) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { //fallthru } return -1; }
Example 14
Source File: NativeArray.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param args arguments: element to search for and optional from index * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static double lastIndexOf(final Object self, final Object... args) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final Object searchElement = args.length > 0 ? args[0] : ScriptRuntime.UNDEFINED; final long n = args.length > 1 ? JSType.toLong(args[1]) : len - 1; for (long k = n < 0 ? len - Math.abs(n) : Math.min(n, len - 1); k >= 0; k--) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { throw typeError("not.an.object", ScriptRuntime.safeToString(self)); } return -1; }
Example 15
Source File: NativeArray.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param searchElement element to search for * @param fromIndex start index of search * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static double indexOf(final Object self, final Object searchElement, final Object fromIndex) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final long n = JSType.toLong(fromIndex); if (n >= len) { return -1; } for (long k = Math.max(0, n < 0 ? len - Math.abs(n) : n); k < len; k++) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { //fallthru } return -1; }
Example 16
Source File: NativeArray.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param args arguments: element to search for and optional from index * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static double lastIndexOf(final Object self, final Object... args) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final Object searchElement = args.length > 0 ? args[0] : ScriptRuntime.UNDEFINED; final long n = args.length > 1 ? JSType.toLong(args[1]) : len - 1; for (long k = n < 0 ? len - Math.abs(n) : Math.min(n, len - 1); k >= 0; k--) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { throw typeError("not.an.object", ScriptRuntime.safeToString(self)); } return -1; }
Example 17
Source File: NativeArray.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param searchElement element to search for * @param fromIndex start index of search * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static double indexOf(final Object self, final Object searchElement, final Object fromIndex) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final long n = JSType.toLong(fromIndex); if (n >= len) { return -1; } for (long k = Math.max(0, n < 0 ? len - Math.abs(n) : n); k < len; k++) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { //fallthru } return -1; }
Example 18
Source File: NativeArray.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param args arguments: element to search for and optional from index * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static long lastIndexOf(final Object self, final Object... args) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final Object searchElement = args.length > 0 ? args[0] : ScriptRuntime.UNDEFINED; final long n = args.length > 1 ? JSType.toLong(args[1]) : len - 1; for (long k = n < 0 ? len - Math.abs(n) : Math.min(n, len - 1); k >= 0; k--) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { throw typeError("not.an.object", ScriptRuntime.safeToString(self)); } return -1; }
Example 19
Source File: NativeArray.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.14 Array.prototype.indexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param searchElement element to search for * @param fromIndex start index of search * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static long indexOf(final Object self, final Object searchElement, final Object fromIndex) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final long n = JSType.toLong(fromIndex); if (n >= len) { return -1; } for (long k = Math.max(0, n < 0 ? len - Math.abs(n) : n); k < len; k++) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { //fallthru } return -1; }
Example 20
Source File: NativeArray.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 15.4.4.15 Array.prototype.lastIndexOf ( searchElement [ , fromIndex ] ) * * @param self self reference * @param args arguments: element to search for and optional from index * @return index of element, or -1 if not found */ @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1) public static double lastIndexOf(final Object self, final Object... args) { try { final ScriptObject sobj = (ScriptObject)Global.toObject(self); final long len = JSType.toUint32(sobj.getLength()); if (len == 0) { return -1; } final Object searchElement = args.length > 0 ? args[0] : ScriptRuntime.UNDEFINED; final long n = args.length > 1 ? JSType.toLong(args[1]) : len - 1; for (long k = n < 0 ? len - Math.abs(n) : Math.min(n, len - 1); k >= 0; k--) { if (sobj.has(k)) { if (ScriptRuntime.EQ_STRICT(sobj.get(k), searchElement)) { return k; } } } } catch (final ClassCastException | NullPointerException e) { throw typeError("not.an.object", ScriptRuntime.safeToString(self)); } return -1; }