Package org.htmlunit.corejs.javascript
Class NativeArray
- java.lang.Object
-
- org.htmlunit.corejs.javascript.ScriptableObject
-
- org.htmlunit.corejs.javascript.IdScriptableObject
-
- org.htmlunit.corejs.javascript.NativeArray
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable,java.util.Collection,java.util.List,ConstProperties,DebuggableObject,IdFunctionCall,Scriptable,SymbolScriptable
public class NativeArray extends IdScriptableObject implements java.util.List
This class implements the Array native object.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classNativeArray.ElementComparatorstatic classNativeArray.StringLikeComparator-
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
ScriptableObject.KeyComparator
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.ObjectARRAY_TAGprivate static intConstructorId_concatprivate static intConstructorId_everyprivate static intConstructorId_filterprivate static intConstructorId_findprivate static intConstructorId_findIndexprivate static intConstructorId_forEachprivate static intConstructorId_fromprivate static intConstructorId_indexOfprivate static intConstructorId_isArrayprivate static intConstructorId_joinprivate static intConstructorId_lastIndexOfprivate static intConstructorId_mapprivate static intConstructorId_ofprivate static intConstructorId_popprivate static intConstructorId_pushprivate static intConstructorId_reduceprivate static intConstructorId_reduceRightprivate static intConstructorId_reverseprivate static intConstructorId_shiftprivate static intConstructorId_sliceprivate static intConstructorId_someprivate static intConstructorId_sortprivate static intConstructorId_spliceprivate static intConstructorId_unshiftprivate static java.util.Comparator<java.lang.Object>DEFAULT_COMPARATORprivate static intDEFAULT_INITIAL_CAPACITYThe default capacity fordense.private java.lang.Object[]denseFast storage for dense arrays.private booleandenseOnlyTrue if all numeric properties are stored indense.private static doubleGROW_FACTORThe factor to growdenseby.private static intId_atprivate static intId_concatprivate static intId_constructorprivate static intId_copyWithinprivate static intId_entriesprivate static intId_everyprivate static intId_fillprivate static intId_filterprivate static intId_findprivate static intId_findIndexprivate static intId_flatprivate static intId_flatMapprivate static intId_forEachprivate static intId_includesprivate static intId_indexOfprivate static intId_joinprivate static intId_keysprivate static intId_lastIndexOfprivate static intId_lengthprivate static intId_mapprivate static intId_popprivate static intId_pushprivate static intId_reduceprivate static intId_reduceRightprivate static intId_reverseprivate static intId_shiftprivate static intId_sliceprivate static intId_someprivate static intId_sortprivate static intId_spliceprivate static intId_toLocaleStringprivate static intId_toSourceprivate static intId_toStringprivate static intId_unshiftprivate static intId_valuesprivate longlengthInternal representation of the JavaScript array's length property.private intlengthAttrAttributes of the array's length propertyprivate static intMAX_INSTANCE_IDprivate static intMAX_PRE_GROW_SIZEprivate static intMAX_PROTOTYPE_IDprivate static intmaximumInitialCapacityThe maximum size ofdensethat will be allocated initially.private intmodCountmodCount required for subList/iteratorsprivate static java.lang.LongNEGATIVE_ONEprivate static longserialVersionUIDprivate static java.util.Comparator<java.lang.Object>STRING_COMPARATOR-
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
-
Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
-
-
Constructor Summary
Constructors Constructor Description NativeArray(long lengthArg)NativeArray(java.lang.Object[] array)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidadd(int index, java.lang.Object element)booleanadd(java.lang.Object o)booleanaddAll(int index, java.util.Collection c)booleanaddAll(java.util.Collection c)private static ScriptablecallConstructorOrCreateArray(Context cx, Scriptable scope, Scriptable arg, long length, boolean lengthAlways)private voidcheckModCount(int modCount)voidclear()private static longconcatSpreadArg(Context cx, Scriptable result, Scriptable arg, long offset)booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection c)private ScriptableObjectdefaultIndexPropertyDescriptor(java.lang.Object value)private static voiddefineElem(Context cx, Scriptable target, long index, java.lang.Object value)private static voiddefineElemOrThrow(Context cx, Scriptable target, long index, java.lang.Object value)protected booleandefineOwnProperty(Context cx, java.lang.Object id, ScriptableObject desc, boolean checkValid)Defines a property on an object.voiddelete(int index)Removes the indexed property from the object.voiddelete(Symbol key)Removes an object like the others, but using a Symbol as the key.private static voiddeleteElem(Scriptable target, long index)private static longdoConcat(Context cx, Scriptable scope, Scriptable result, java.lang.Object arg, long offset)private booleanensureCapacity(int capacity)java.lang.ObjectexecIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.protected voidfillConstructorProperties(IdFunctionObject ctor)protected intfindInstanceIdInfo(java.lang.String s)Map name to id of instance property.protected intfindPrototypeId(java.lang.String s)protected intfindPrototypeId(Symbol k)private static Scriptableflat(Context cx, Scriptable scope, Scriptable source, double depth)java.lang.Objectget(int index)java.lang.Objectget(int index, Scriptable start)Returns the value of the indexed property or NOT_FOUND.java.lang.Objectget(long index)java.lang.Objectget(Symbol key, Scriptable start)Another version of Get that supports Symbol keyed properties.intgetAttributes(int index)Get the attributes of an indexed property.private static FunctiongetCallbackArg(Context cx, java.lang.Object callbackArg)java.lang.StringgetClassName()Return the name of the class.java.lang.ObjectgetDefaultValue(java.lang.Class<?> hint)Implements the [[DefaultValue]] internal method.private static java.lang.ObjectgetElem(Context cx, Scriptable target, long index)java.lang.Object[]getIds(boolean nonEnumerable, boolean getSymbols)java.util.List<java.lang.Integer>getIndexIds()protected java.lang.StringgetInstanceIdName(int id)Map id back to property name it defines.protected java.lang.ObjectgetInstanceIdValue(int id)Get id value.longgetLength()(package private) static longgetLengthProperty(Context cx, Scriptable obj)(package private) static intgetMaximumInitialCapacity()protected intgetMaxInstanceId()Get maximum id findInstanceIdInfo can generate.protected ScriptableObjectgetOwnPropertyDescriptor(Context cx, java.lang.Object id)private static java.lang.ObjectgetRawElem(Scriptable target, long index)booleanhas(int index, Scriptable start)Returns true if the property index is defined.booleanhas(Symbol key, Scriptable start)A version of "has" that supports symbols.intindexOf(java.lang.Object o)(package private) static voidinit(Context cx, Scriptable scope, boolean sealed)protected voidinitPrototypeId(int id)private static booleanisConcatSpreadable(Context cx, Scriptable scope, java.lang.Object val)booleanisEmpty()private static java.lang.ObjectiterativeMethod(Context cx, IdFunctionObject idFunctionObject, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)Implements the methods "every", "filter", "forEach", "map", and "some".java.util.Iteratoriterator()private static java.lang.Objectjs_at(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static Scriptablejs_concat(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static java.lang.Objectjs_copyWithin(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static java.lang.Objectjs_fill(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static java.lang.Objectjs_flat(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static java.lang.Objectjs_flatMap(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static java.lang.Objectjs_from(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static java.lang.Booleanjs_includes(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static java.lang.Objectjs_indexOf(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static booleanjs_isArray(java.lang.Object o)private static java.lang.Stringjs_join(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)See ECMA 15.4.4.3private static java.lang.Objectjs_lastIndexOf(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static java.lang.Objectjs_of(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static java.lang.Objectjs_pop(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static java.lang.Objectjs_push(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static Scriptablejs_reverse(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)See ECMA 15.4.4.4private static java.lang.Objectjs_shift(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static Scriptablejs_slice(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static Scriptablejs_sort(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)See ECMA 15.4.4.5private static java.lang.Objectjs_splice(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static java.lang.Objectjs_unshift(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)private static java.lang.ObjectjsConstructor(Context cx, Scriptable scope, java.lang.Object[] args)See ECMA 15.4.1,2longjsGet_length()Deprecated.UsegetLength()instead.intlastIndexOf(java.lang.Object o)java.util.ListIteratorlistIterator()java.util.ListIteratorlistIterator(int start)voidput(int index, Scriptable start, java.lang.Object value)Sets the value of the indexed property, creating it if need be.voidput(java.lang.String id, Scriptable start, java.lang.Object value)Sets the value of the named property, creating it if need be.voidput(Symbol key, Scriptable start, java.lang.Object value)Implementation of put required by SymbolScriptable objects.private static java.lang.ObjectreduceMethod(Context cx, int id, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)Implements the methods "reduce" and "reduceRight".java.lang.Objectremove(int index)booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection c)booleanretainAll(java.util.Collection c)java.lang.Objectset(int index, java.lang.Object element)(package private) voidsetDenseOnly(boolean denseOnly)Change the value of the internal flag that determines whether all storage is handed by a dense backing array rather than an associative store.private static voidsetElem(Context cx, Scriptable target, long index, java.lang.Object value)protected voidsetInstanceIdAttributes(int id, int attr)Update the attributes of the given instance property.protected voidsetInstanceIdValue(int id, java.lang.Object value)Set or delete id value.private voidsetLength(java.lang.Object val)private static java.lang.ObjectsetLengthProperty(Context cx, Scriptable target, long length)(package private) static voidsetMaximumInitialCapacity(int maximumInitialCapacity)voidsetPrototype(Scriptable p)Sets the prototype of the object.private static voidsetRawElem(Context cx, Scriptable target, long index, java.lang.Object value)intsize()java.util.ListsubList(int fromIndex, int toIndex)java.lang.Object[]toArray()java.lang.Object[]toArray(java.lang.Object[] a)private static longtoArrayIndex(double d)private static longtoArrayIndex(java.lang.Object id)private static longtoArrayIndex(java.lang.String id)private static inttoDenseIndex(java.lang.Object id)private static longtoSliceIndex(double value, long length)private static java.lang.StringtoStringHelper(Context cx, Scriptable scope, Scriptable thisObj, boolean toSource, boolean toLocale)-
Methods inherited from class org.htmlunit.corejs.javascript.IdScriptableObject
activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultHas, defaultPut, delete, ensureType, exportAsJSClass, findInstanceIdInfo, get, getAttributes, getAttributes, has, hasPrototypeMap, initPrototypeConstructor, initPrototypeMethod, initPrototypeMethod, initPrototypeMethod, initPrototypeValue, initPrototypeValue, instanceIdInfo, setAttributes
-
Methods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
addLazilyInitializedValue, applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildClassCtor, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, checkValidAttributes, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getBase, getBase, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, hasInstance, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, putConst, putConstProperty, putImpl, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
ARRAY_TAG
private static final java.lang.Object ARRAY_TAG
-
NEGATIVE_ONE
private static final java.lang.Long NEGATIVE_ONE
-
Id_length
private static final int Id_length
- See Also:
- Constant Field Values
-
MAX_INSTANCE_ID
private static final int MAX_INSTANCE_ID
- See Also:
- Constant Field Values
-
STRING_COMPARATOR
private static final java.util.Comparator<java.lang.Object> STRING_COMPARATOR
-
DEFAULT_COMPARATOR
private static final java.util.Comparator<java.lang.Object> DEFAULT_COMPARATOR
-
Id_constructor
private static final int Id_constructor
- See Also:
- Constant Field Values
-
Id_toString
private static final int Id_toString
- See Also:
- Constant Field Values
-
Id_toLocaleString
private static final int Id_toLocaleString
- See Also:
- Constant Field Values
-
Id_toSource
private static final int Id_toSource
- See Also:
- Constant Field Values
-
Id_join
private static final int Id_join
- See Also:
- Constant Field Values
-
Id_reverse
private static final int Id_reverse
- See Also:
- Constant Field Values
-
Id_sort
private static final int Id_sort
- See Also:
- Constant Field Values
-
Id_push
private static final int Id_push
- See Also:
- Constant Field Values
-
Id_pop
private static final int Id_pop
- See Also:
- Constant Field Values
-
Id_shift
private static final int Id_shift
- See Also:
- Constant Field Values
-
Id_unshift
private static final int Id_unshift
- See Also:
- Constant Field Values
-
Id_splice
private static final int Id_splice
- See Also:
- Constant Field Values
-
Id_concat
private static final int Id_concat
- See Also:
- Constant Field Values
-
Id_slice
private static final int Id_slice
- See Also:
- Constant Field Values
-
Id_indexOf
private static final int Id_indexOf
- See Also:
- Constant Field Values
-
Id_lastIndexOf
private static final int Id_lastIndexOf
- See Also:
- Constant Field Values
-
Id_every
private static final int Id_every
- See Also:
- Constant Field Values
-
Id_filter
private static final int Id_filter
- See Also:
- Constant Field Values
-
Id_forEach
private static final int Id_forEach
- See Also:
- Constant Field Values
-
Id_map
private static final int Id_map
- See Also:
- Constant Field Values
-
Id_some
private static final int Id_some
- See Also:
- Constant Field Values
-
Id_find
private static final int Id_find
- See Also:
- Constant Field Values
-
Id_findIndex
private static final int Id_findIndex
- See Also:
- Constant Field Values
-
Id_reduce
private static final int Id_reduce
- See Also:
- Constant Field Values
-
Id_reduceRight
private static final int Id_reduceRight
- See Also:
- Constant Field Values
-
Id_fill
private static final int Id_fill
- See Also:
- Constant Field Values
-
Id_keys
private static final int Id_keys
- See Also:
- Constant Field Values
-
Id_values
private static final int Id_values
- See Also:
- Constant Field Values
-
Id_entries
private static final int Id_entries
- See Also:
- Constant Field Values
-
Id_includes
private static final int Id_includes
- See Also:
- Constant Field Values
-
Id_copyWithin
private static final int Id_copyWithin
- See Also:
- Constant Field Values
-
Id_at
private static final int Id_at
- See Also:
- Constant Field Values
-
Id_flat
private static final int Id_flat
- See Also:
- Constant Field Values
-
Id_flatMap
private static final int Id_flatMap
- See Also:
- Constant Field Values
-
MAX_PROTOTYPE_ID
private static final int MAX_PROTOTYPE_ID
- See Also:
- Constant Field Values
-
ConstructorId_join
private static final int ConstructorId_join
- See Also:
- Constant Field Values
-
ConstructorId_reverse
private static final int ConstructorId_reverse
- See Also:
- Constant Field Values
-
ConstructorId_sort
private static final int ConstructorId_sort
- See Also:
- Constant Field Values
-
ConstructorId_push
private static final int ConstructorId_push
- See Also:
- Constant Field Values
-
ConstructorId_pop
private static final int ConstructorId_pop
- See Also:
- Constant Field Values
-
ConstructorId_shift
private static final int ConstructorId_shift
- See Also:
- Constant Field Values
-
ConstructorId_unshift
private static final int ConstructorId_unshift
- See Also:
- Constant Field Values
-
ConstructorId_splice
private static final int ConstructorId_splice
- See Also:
- Constant Field Values
-
ConstructorId_concat
private static final int ConstructorId_concat
- See Also:
- Constant Field Values
-
ConstructorId_slice
private static final int ConstructorId_slice
- See Also:
- Constant Field Values
-
ConstructorId_indexOf
private static final int ConstructorId_indexOf
- See Also:
- Constant Field Values
-
ConstructorId_lastIndexOf
private static final int ConstructorId_lastIndexOf
- See Also:
- Constant Field Values
-
ConstructorId_every
private static final int ConstructorId_every
- See Also:
- Constant Field Values
-
ConstructorId_filter
private static final int ConstructorId_filter
- See Also:
- Constant Field Values
-
ConstructorId_forEach
private static final int ConstructorId_forEach
- See Also:
- Constant Field Values
-
ConstructorId_map
private static final int ConstructorId_map
- See Also:
- Constant Field Values
-
ConstructorId_some
private static final int ConstructorId_some
- See Also:
- Constant Field Values
-
ConstructorId_find
private static final int ConstructorId_find
- See Also:
- Constant Field Values
-
ConstructorId_findIndex
private static final int ConstructorId_findIndex
- See Also:
- Constant Field Values
-
ConstructorId_reduce
private static final int ConstructorId_reduce
- See Also:
- Constant Field Values
-
ConstructorId_reduceRight
private static final int ConstructorId_reduceRight
- See Also:
- Constant Field Values
-
ConstructorId_isArray
private static final int ConstructorId_isArray
- See Also:
- Constant Field Values
-
ConstructorId_of
private static final int ConstructorId_of
- See Also:
- Constant Field Values
-
ConstructorId_from
private static final int ConstructorId_from
- See Also:
- Constant Field Values
-
length
private long length
Internal representation of the JavaScript array's length property.
-
lengthAttr
private int lengthAttr
Attributes of the array's length property
-
modCount
private transient int modCount
modCount required for subList/iterators
-
dense
private java.lang.Object[] dense
Fast storage for dense arrays. Sparse arrays will use the superclass's hashtable storage scheme.
-
denseOnly
private boolean denseOnly
True if all numeric properties are stored indense.
-
maximumInitialCapacity
private static int maximumInitialCapacity
The maximum size ofdensethat will be allocated initially.
-
DEFAULT_INITIAL_CAPACITY
private static final int DEFAULT_INITIAL_CAPACITY
The default capacity fordense.- See Also:
- Constant Field Values
-
GROW_FACTOR
private static final double GROW_FACTOR
The factor to growdenseby.- See Also:
- Constant Field Values
-
MAX_PRE_GROW_SIZE
private static final int MAX_PRE_GROW_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
init
static void init(Context cx, Scriptable scope, boolean sealed)
-
getMaximumInitialCapacity
static int getMaximumInitialCapacity()
-
setMaximumInitialCapacity
static void setMaximumInitialCapacity(int maximumInitialCapacity)
-
getClassName
public java.lang.String getClassName()
Description copied from class:ScriptableObjectReturn the name of the class.This is typically the same name as the constructor. Classes extending ScriptableObject must implement this abstract method.
- Specified by:
getClassNamein interfaceScriptable- Specified by:
getClassNamein classScriptableObject
-
getMaxInstanceId
protected int getMaxInstanceId()
Description copied from class:IdScriptableObjectGet maximum id findInstanceIdInfo can generate.- Overrides:
getMaxInstanceIdin classIdScriptableObject
-
setInstanceIdAttributes
protected void setInstanceIdAttributes(int id, int attr)Description copied from class:IdScriptableObjectUpdate the attributes of the given instance property. Classes which want to support changing property attributes via Object.defineProperty must override this method. The default implementation throws InternalError.- Overrides:
setInstanceIdAttributesin classIdScriptableObject- Parameters:
id- the instance property idattr- the new attribute bitset
-
findInstanceIdInfo
protected int findInstanceIdInfo(java.lang.String s)
Description copied from class:IdScriptableObjectMap name to id of instance property. Should return 0 if not found or the result ofIdScriptableObject.instanceIdInfo(int, int).- Overrides:
findInstanceIdInfoin classIdScriptableObject
-
getInstanceIdName
protected java.lang.String getInstanceIdName(int id)
Description copied from class:IdScriptableObjectMap id back to property name it defines.- Overrides:
getInstanceIdNamein classIdScriptableObject
-
getInstanceIdValue
protected java.lang.Object getInstanceIdValue(int id)
Description copied from class:IdScriptableObjectGet id value. * If id value is constant, descendant can call cacheIdValue to store * value in the permanent cache. * Default implementation creates IdFunctionObject instance for given id * and cache its value- Overrides:
getInstanceIdValuein classIdScriptableObject
-
setInstanceIdValue
protected void setInstanceIdValue(int id, java.lang.Object value)Description copied from class:IdScriptableObjectSet or delete id value. If value == NOT_FOUND , the implementation should make sure that the following getInstanceIdValue return NOT_FOUND.- Overrides:
setInstanceIdValuein classIdScriptableObject
-
fillConstructorProperties
protected void fillConstructorProperties(IdFunctionObject ctor)
- Overrides:
fillConstructorPropertiesin classIdScriptableObject
-
initPrototypeId
protected void initPrototypeId(int id)
- Overrides:
initPrototypeIdin classIdScriptableObject
-
execIdCall
public java.lang.Object execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Description copied from class:IdScriptableObject'thisObj' will be null if invoked as constructor, in which case * instance of Scriptable should be returned.- Specified by:
execIdCallin interfaceIdFunctionCall- Overrides:
execIdCallin classIdScriptableObject
-
setPrototype
public void setPrototype(Scriptable p)
Description copied from class:ScriptableObjectSets the prototype of the object.- Specified by:
setPrototypein interfaceScriptable- Overrides:
setPrototypein classScriptableObject- Parameters:
p- the prototype to set
-
get
public java.lang.Object get(int index, Scriptable start)Description copied from class:ScriptableObjectReturns the value of the indexed property or NOT_FOUND.- Specified by:
getin interfaceScriptable- Overrides:
getin classScriptableObject- Parameters:
index- the numeric index for the propertystart- the object in which the lookup began- Returns:
- the value of the property (may be null), or NOT_FOUND
- See Also:
Scriptable.get(String,Scriptable)
-
has
public boolean has(int index, Scriptable start)Description copied from class:ScriptableObjectReturns true if the property index is defined.- Specified by:
hasin interfaceScriptable- Overrides:
hasin classScriptableObject- Parameters:
index- the numeric index for the propertystart- the object in which the lookup began- Returns:
- true if and only if the property was found in the object
- See Also:
Scriptable.get(int, Scriptable),ScriptableObject.getProperty(Scriptable, int)
-
has
public boolean has(Symbol key, Scriptable start)
Description copied from class:ScriptableObjectA version of "has" that supports symbols.- Specified by:
hasin interfaceSymbolScriptable- Overrides:
hasin classIdScriptableObject
-
get
public java.lang.Object get(Symbol key, Scriptable start)
Description copied from class:ScriptableObjectAnother version of Get that supports Symbol keyed properties.- Specified by:
getin interfaceSymbolScriptable- Overrides:
getin classIdScriptableObject
-
put
public void put(Symbol key, Scriptable start, java.lang.Object value)
Description copied from class:ScriptableObjectImplementation of put required by SymbolScriptable objects.- Specified by:
putin interfaceSymbolScriptable- Overrides:
putin classIdScriptableObject
-
delete
public void delete(Symbol key)
Description copied from class:ScriptableObjectRemoves an object like the others, but using a Symbol as the key.- Specified by:
deletein interfaceSymbolScriptable- Overrides:
deletein classIdScriptableObject
-
toArrayIndex
private static long toArrayIndex(java.lang.Object id)
-
toArrayIndex
private static long toArrayIndex(java.lang.String id)
-
toArrayIndex
private static long toArrayIndex(double d)
-
toDenseIndex
private static int toDenseIndex(java.lang.Object id)
-
put
public void put(java.lang.String id, Scriptable start, java.lang.Object value)Description copied from class:ScriptableObjectSets the value of the named property, creating it if need be.If the property was created using defineProperty, the appropriate setter method is called.
If the property's attributes include READONLY, no action is taken. This method will actually set the property in the start object.
- Specified by:
putin interfaceScriptable- Overrides:
putin classIdScriptableObject- Parameters:
id- the name of the propertystart- the object whose property is being setvalue- value to set the property to- See Also:
Scriptable.has(String, Scriptable),Scriptable.get(String, Scriptable),ScriptableObject.putProperty(Scriptable, String, Object),Context.toObject(Object, Scriptable)
-
ensureCapacity
private boolean ensureCapacity(int capacity)
-
put
public void put(int index, Scriptable start, java.lang.Object value)Description copied from class:ScriptableObjectSets the value of the indexed property, creating it if need be.- Specified by:
putin interfaceScriptable- Overrides:
putin classScriptableObject- Parameters:
index- the numeric index for the propertystart- the object whose property is being setvalue- value to set the property to- See Also:
Scriptable.has(int, Scriptable),Scriptable.get(int, Scriptable),ScriptableObject.putProperty(Scriptable, int, Object),Context.toObject(Object, Scriptable)
-
delete
public void delete(int index)
Description copied from class:ScriptableObjectRemoves the indexed property from the object.If the property is not found, or it has the PERMANENT attribute, no action is taken.
- Specified by:
deletein interfaceScriptable- Overrides:
deletein classScriptableObject- Parameters:
index- the numeric index for the property- See Also:
Scriptable.get(int, Scriptable),ScriptableObject.deleteProperty(Scriptable, int)
-
getIds
public java.lang.Object[] getIds(boolean nonEnumerable, boolean getSymbols)- Overrides:
getIdsin classIdScriptableObject
-
getIndexIds
public java.util.List<java.lang.Integer> getIndexIds()
-
getDefaultValue
public java.lang.Object getDefaultValue(java.lang.Class<?> hint)
Description copied from class:ScriptableObjectImplements the [[DefaultValue]] internal method.Note that the toPrimitive conversion is a no-op for every type other than Object, for which [[DefaultValue]] is called. See ECMA 9.1.
A
hintof null means "no hint".- Specified by:
getDefaultValuein interfaceScriptable- Overrides:
getDefaultValuein classScriptableObject- Parameters:
hint- the type hint- Returns:
- the default value for the object
See ECMA 8.6.2.6.
-
defaultIndexPropertyDescriptor
private ScriptableObject defaultIndexPropertyDescriptor(java.lang.Object value)
-
getAttributes
public int getAttributes(int index)
Description copied from class:ScriptableObjectGet the attributes of an indexed property.- Overrides:
getAttributesin classScriptableObject- Parameters:
index- the numeric index for the property- Returns:
- the bitset of attributes
- See Also:
ScriptableObject.has(String, Scriptable),ScriptableObject.READONLY,ScriptableObject.DONTENUM,ScriptableObject.PERMANENT,ScriptableObject.EMPTY
-
getOwnPropertyDescriptor
protected ScriptableObject getOwnPropertyDescriptor(Context cx, java.lang.Object id)
- Overrides:
getOwnPropertyDescriptorin classIdScriptableObject
-
defineOwnProperty
protected boolean defineOwnProperty(Context cx, java.lang.Object id, ScriptableObject desc, boolean checkValid)
Description copied from class:ScriptableObjectDefines a property on an object.Based on [[DefineOwnProperty]] from 8.12.10 of the spec.
- Overrides:
defineOwnPropertyin classIdScriptableObject- Parameters:
cx- the current Contextid- the name/index of the propertydesc- the new property descriptor, as described in 8.6.1checkValid- whether to perform validity checks
-
jsConstructor
private static java.lang.Object jsConstructor(Context cx, Scriptable scope, java.lang.Object[] args)
See ECMA 15.4.1,2
-
callConstructorOrCreateArray
private static Scriptable callConstructorOrCreateArray(Context cx, Scriptable scope, Scriptable arg, long length, boolean lengthAlways)
-
js_from
private static java.lang.Object js_from(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
js_of
private static java.lang.Object js_of(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
getLength
public long getLength()
-
jsGet_length
@Deprecated public long jsGet_length()
Deprecated.UsegetLength()instead.
-
setDenseOnly
void setDenseOnly(boolean denseOnly)
Change the value of the internal flag that determines whether all storage is handed by a dense backing array rather than an associative store.- Parameters:
denseOnly- new value for denseOnly flag- Throws:
java.lang.IllegalArgumentException- if an attempt is made to enable denseOnly after it was disabled; NativeArray code is not written to handle switching back to a dense representation
-
setLength
private void setLength(java.lang.Object val)
-
getLengthProperty
static long getLengthProperty(Context cx, Scriptable obj)
-
setLengthProperty
private static java.lang.Object setLengthProperty(Context cx, Scriptable target, long length)
-
deleteElem
private static void deleteElem(Scriptable target, long index)
-
getElem
private static java.lang.Object getElem(Context cx, Scriptable target, long index)
-
getRawElem
private static java.lang.Object getRawElem(Scriptable target, long index)
-
defineElem
private static void defineElem(Context cx, Scriptable target, long index, java.lang.Object value)
-
defineElemOrThrow
private static void defineElemOrThrow(Context cx, Scriptable target, long index, java.lang.Object value)
-
setElem
private static void setElem(Context cx, Scriptable target, long index, java.lang.Object value)
-
setRawElem
private static void setRawElem(Context cx, Scriptable target, long index, java.lang.Object value)
-
toStringHelper
private static java.lang.String toStringHelper(Context cx, Scriptable scope, Scriptable thisObj, boolean toSource, boolean toLocale)
-
js_join
private static java.lang.String js_join(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
See ECMA 15.4.4.3
-
js_reverse
private static Scriptable js_reverse(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
See ECMA 15.4.4.4
-
js_sort
private static Scriptable js_sort(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
See ECMA 15.4.4.5
-
js_push
private static java.lang.Object js_push(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
js_pop
private static java.lang.Object js_pop(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
js_shift
private static java.lang.Object js_shift(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
js_unshift
private static java.lang.Object js_unshift(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
js_splice
private static java.lang.Object js_splice(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
isConcatSpreadable
private static boolean isConcatSpreadable(Context cx, Scriptable scope, java.lang.Object val)
-
concatSpreadArg
private static long concatSpreadArg(Context cx, Scriptable result, Scriptable arg, long offset)
-
doConcat
private static long doConcat(Context cx, Scriptable scope, Scriptable result, java.lang.Object arg, long offset)
-
js_concat
private static Scriptable js_concat(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
js_slice
private static Scriptable js_slice(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
toSliceIndex
private static long toSliceIndex(double value, long length)
-
js_indexOf
private static java.lang.Object js_indexOf(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
js_lastIndexOf
private static java.lang.Object js_lastIndexOf(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
js_includes
private static java.lang.Boolean js_includes(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
js_fill
private static java.lang.Object js_fill(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
js_copyWithin
private static java.lang.Object js_copyWithin(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
js_at
private static java.lang.Object js_at(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
js_flat
private static java.lang.Object js_flat(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
flat
private static Scriptable flat(Context cx, Scriptable scope, Scriptable source, double depth)
-
js_flatMap
private static java.lang.Object js_flatMap(Context cx, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
-
iterativeMethod
private static java.lang.Object iterativeMethod(Context cx, IdFunctionObject idFunctionObject, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Implements the methods "every", "filter", "forEach", "map", and "some".
-
reduceMethod
private static java.lang.Object reduceMethod(Context cx, int id, Scriptable scope, Scriptable thisObj, java.lang.Object[] args)
Implements the methods "reduce" and "reduceRight".
-
js_isArray
private static boolean js_isArray(java.lang.Object o)
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
containsin interfacejava.util.Collection- Specified by:
containsin interfacejava.util.List
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArrayin interfacejava.util.Collection- Specified by:
toArrayin interfacejava.util.List
-
toArray
public java.lang.Object[] toArray(java.lang.Object[] a)
- Specified by:
toArrayin interfacejava.util.Collection- Specified by:
toArrayin interfacejava.util.List
-
containsAll
public boolean containsAll(java.util.Collection c)
- Specified by:
containsAllin interfacejava.util.Collection- Specified by:
containsAllin interfacejava.util.List
-
size
public int size()
- Specified by:
sizein interfacejava.util.Collection- Specified by:
sizein interfacejava.util.List- Overrides:
sizein classScriptableObject
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Collection- Specified by:
isEmptyin interfacejava.util.List- Overrides:
isEmptyin classScriptableObject
-
get
public java.lang.Object get(long index)
-
get
public java.lang.Object get(int index)
- Specified by:
getin interfacejava.util.List
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOfin interfacejava.util.List
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOfin interfacejava.util.List
-
iterator
public java.util.Iterator iterator()
- Specified by:
iteratorin interfacejava.util.Collection- Specified by:
iteratorin interfacejava.lang.Iterable- Specified by:
iteratorin interfacejava.util.List
-
listIterator
public java.util.ListIterator listIterator()
- Specified by:
listIteratorin interfacejava.util.List
-
listIterator
public java.util.ListIterator listIterator(int start)
- Specified by:
listIteratorin interfacejava.util.List
-
add
public boolean add(java.lang.Object o)
- Specified by:
addin interfacejava.util.Collection- Specified by:
addin interfacejava.util.List
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
removein interfacejava.util.Collection- Specified by:
removein interfacejava.util.List
-
addAll
public boolean addAll(java.util.Collection c)
- Specified by:
addAllin interfacejava.util.Collection- Specified by:
addAllin interfacejava.util.List
-
removeAll
public boolean removeAll(java.util.Collection c)
- Specified by:
removeAllin interfacejava.util.Collection- Specified by:
removeAllin interfacejava.util.List
-
retainAll
public boolean retainAll(java.util.Collection c)
- Specified by:
retainAllin interfacejava.util.Collection- Specified by:
retainAllin interfacejava.util.List
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection- Specified by:
clearin interfacejava.util.List
-
add
public void add(int index, java.lang.Object element)- Specified by:
addin interfacejava.util.List
-
addAll
public boolean addAll(int index, java.util.Collection c)- Specified by:
addAllin interfacejava.util.List
-
set
public java.lang.Object set(int index, java.lang.Object element)- Specified by:
setin interfacejava.util.List
-
remove
public java.lang.Object remove(int index)
- Specified by:
removein interfacejava.util.List
-
subList
public java.util.List subList(int fromIndex, int toIndex)- Specified by:
subListin interfacejava.util.List
-
checkModCount
private void checkModCount(int modCount)
-
findPrototypeId
protected int findPrototypeId(Symbol k)
- Overrides:
findPrototypeIdin classIdScriptableObject
-
findPrototypeId
protected int findPrototypeId(java.lang.String s)
- Overrides:
findPrototypeIdin classIdScriptableObject
-
-