Package org.mozilla.javascript
Class NativeArray
- java.lang.Object
- 
- org.mozilla.javascript.ScriptableObject
- 
- org.mozilla.javascript.IdScriptableObject
- 
- org.mozilla.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 SummaryNested Classes Modifier and Type Class Description static classNativeArray.ElementComparatorstatic classNativeArray.StringLikeComparator- 
Nested classes/interfaces inherited from class org.mozilla.javascript.ScriptableObjectScriptableObject.KeyComparator
 
- 
 - 
Field Summary- 
Fields inherited from class org.mozilla.javascript.ScriptableObjectCONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
 - 
Fields inherited from interface org.mozilla.javascript.ScriptableNOT_FOUND
 
- 
 - 
Constructor SummaryConstructors Constructor Description NativeArray(long lengthArg)NativeArray(java.lang.Object[] array)
 - 
Method SummaryAll 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)voidclear()booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection c)protected voiddefineOwnProperty(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.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)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.java.lang.StringgetClassName()Return the name of the class.java.lang.ObjectgetDefaultValue(java.lang.Class<?> hint)Implements the [[DefaultValue]] internal method.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()protected intgetMaxInstanceId()Get maximum id findInstanceIdInfo can generate.protected ScriptableObjectgetOwnPropertyDescriptor(Context cx, java.lang.Object id)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)protected voidinitPrototypeId(int id)booleanisEmpty()java.util.Iteratoriterator()longjsGet_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.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)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.voidsetPrototype(Scriptable p)Sets the prototype of the object.intsize()java.util.ListsubList(int fromIndex, int toIndex)java.lang.Object[]toArray()java.lang.Object[]toArray(java.lang.Object[] a)- 
Methods inherited from class org.mozilla.javascript.IdScriptableObjectactivatePrototypeMap, 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.mozilla.javascript.ScriptableObjectapplyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, equivalentValues, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, 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, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setParentScope
 
- 
 
- 
- 
- 
Method Detail- 
getClassNamepublic 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 interface- Scriptable
- Specified by:
- getClassNamein class- ScriptableObject
 
 - 
getMaxInstanceIdprotected int getMaxInstanceId() Description copied from class:IdScriptableObjectGet maximum id findInstanceIdInfo can generate.- Overrides:
- getMaxInstanceIdin class- IdScriptableObject
 
 - 
setInstanceIdAttributesprotected 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 class- IdScriptableObject
- Parameters:
- id- the instance property id
- attr- the new attribute bitset
 
 - 
findInstanceIdInfoprotected 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 class- IdScriptableObject
 
 - 
getInstanceIdNameprotected java.lang.String getInstanceIdName(int id) Description copied from class:IdScriptableObjectMap id back to property name it defines.- Overrides:
- getInstanceIdNamein class- IdScriptableObject
 
 - 
getInstanceIdValueprotected 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 class- IdScriptableObject
 
 - 
setInstanceIdValueprotected 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 class- IdScriptableObject
 
 - 
fillConstructorPropertiesprotected void fillConstructorProperties(IdFunctionObject ctor) - Overrides:
- fillConstructorPropertiesin class- IdScriptableObject
 
 - 
initPrototypeIdprotected void initPrototypeId(int id) - Overrides:
- initPrototypeIdin class- IdScriptableObject
 
 - 
execIdCallpublic 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 interface- IdFunctionCall
- Overrides:
- execIdCallin class- IdScriptableObject
 
 - 
setPrototypepublic void setPrototype(Scriptable p) Description copied from class:ScriptableObjectSets the prototype of the object.- Specified by:
- setPrototypein interface- Scriptable
- Overrides:
- setPrototypein class- ScriptableObject
- Parameters:
- p- the prototype to set
 
 - 
getpublic 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 interface- Scriptable
- Overrides:
- getin class- ScriptableObject
- Parameters:
- index- the numeric index for the property
- start- 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)
 
 - 
haspublic boolean has(int index, Scriptable start)Description copied from class:ScriptableObjectReturns true if the property index is defined.- Specified by:
- hasin interface- Scriptable
- Overrides:
- hasin class- ScriptableObject
- Parameters:
- index- the numeric index for the property
- start- 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)
 
 - 
haspublic boolean has(Symbol key, Scriptable start) Description copied from class:ScriptableObjectA version of "has" that supports symbols.- Specified by:
- hasin interface- SymbolScriptable
- Overrides:
- hasin class- IdScriptableObject
 
 - 
getpublic java.lang.Object get(Symbol key, Scriptable start) Description copied from class:ScriptableObjectAnother version of Get that supports Symbol keyed properties.- Specified by:
- getin interface- SymbolScriptable
- Overrides:
- getin class- IdScriptableObject
 
 - 
putpublic void put(Symbol key, Scriptable start, java.lang.Object value) Description copied from class:ScriptableObjectImplementation of put required by SymbolScriptable objects.- Specified by:
- putin interface- SymbolScriptable
- Overrides:
- putin class- IdScriptableObject
 
 - 
deletepublic void delete(Symbol key) Description copied from class:ScriptableObjectRemoves an object like the others, but using a Symbol as the key.- Specified by:
- deletein interface- SymbolScriptable
- Overrides:
- deletein class- IdScriptableObject
 
 - 
putpublic 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 interface- Scriptable
- Overrides:
- putin class- IdScriptableObject
- Parameters:
- id- the name of the property
- start- the object whose property is being set
- value- 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)
 
 - 
putpublic 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 interface- Scriptable
- Overrides:
- putin class- ScriptableObject
- Parameters:
- index- the numeric index for the property
- start- the object whose property is being set
- value- 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)
 
 - 
deletepublic 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 interface- Scriptable
- Overrides:
- deletein class- ScriptableObject
- Parameters:
- index- the numeric index for the property
- See Also:
- Scriptable.get(int, Scriptable),- ScriptableObject.deleteProperty(Scriptable, int)
 
 - 
getIdspublic java.lang.Object[] getIds(boolean nonEnumerable, boolean getSymbols)
 - 
getIndexIdspublic java.util.List<java.lang.Integer> getIndexIds() 
 - 
getDefaultValuepublic 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 interface- Scriptable
- Overrides:
- getDefaultValuein class- ScriptableObject
- Parameters:
- hint- the type hint
- Returns:
- the default value for the object
     See ECMA 8.6.2.6. 
 
 - 
getAttributespublic int getAttributes(int index) Description copied from class:ScriptableObjectGet the attributes of an indexed property.- Overrides:
- getAttributesin class- ScriptableObject
- 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
 
 - 
getOwnPropertyDescriptorprotected ScriptableObject getOwnPropertyDescriptor(Context cx, java.lang.Object id) - Overrides:
- getOwnPropertyDescriptorin class- IdScriptableObject
 
 - 
defineOwnPropertyprotected void 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 class- IdScriptableObject
- Parameters:
- cx- the current Context
- id- the name/index of the property
- desc- the new property descriptor, as described in 8.6.1
- checkValid- whether to perform validity checks
 
 - 
getLengthpublic long getLength() 
 - 
jsGet_length@Deprecated public long jsGet_length() Deprecated.UsegetLength()instead.
 - 
containspublic boolean contains(java.lang.Object o) - Specified by:
- containsin interface- java.util.Collection
- Specified by:
- containsin interface- java.util.List
 
 - 
toArraypublic java.lang.Object[] toArray() - Specified by:
- toArrayin interface- java.util.Collection
- Specified by:
- toArrayin interface- java.util.List
 
 - 
toArraypublic java.lang.Object[] toArray(java.lang.Object[] a) - Specified by:
- toArrayin interface- java.util.Collection
- Specified by:
- toArrayin interface- java.util.List
 
 - 
containsAllpublic boolean containsAll(java.util.Collection c) - Specified by:
- containsAllin interface- java.util.Collection
- Specified by:
- containsAllin interface- java.util.List
 
 - 
sizepublic int size() - Specified by:
- sizein interface- java.util.Collection
- Specified by:
- sizein interface- java.util.List
- Overrides:
- sizein class- ScriptableObject
 
 - 
isEmptypublic boolean isEmpty() - Specified by:
- isEmptyin interface- java.util.Collection
- Specified by:
- isEmptyin interface- java.util.List
- Overrides:
- isEmptyin class- ScriptableObject
 
 - 
getpublic java.lang.Object get(long index) 
 - 
getpublic java.lang.Object get(int index) - Specified by:
- getin interface- java.util.List
 
 - 
indexOfpublic int indexOf(java.lang.Object o) - Specified by:
- indexOfin interface- java.util.List
 
 - 
lastIndexOfpublic int lastIndexOf(java.lang.Object o) - Specified by:
- lastIndexOfin interface- java.util.List
 
 - 
iteratorpublic java.util.Iterator iterator() - Specified by:
- iteratorin interface- java.util.Collection
- Specified by:
- iteratorin interface- java.lang.Iterable
- Specified by:
- iteratorin interface- java.util.List
 
 - 
listIteratorpublic java.util.ListIterator listIterator() - Specified by:
- listIteratorin interface- java.util.List
 
 - 
listIteratorpublic java.util.ListIterator listIterator(int start) - Specified by:
- listIteratorin interface- java.util.List
 
 - 
addpublic boolean add(java.lang.Object o) - Specified by:
- addin interface- java.util.Collection
- Specified by:
- addin interface- java.util.List
 
 - 
removepublic boolean remove(java.lang.Object o) - Specified by:
- removein interface- java.util.Collection
- Specified by:
- removein interface- java.util.List
 
 - 
addAllpublic boolean addAll(java.util.Collection c) - Specified by:
- addAllin interface- java.util.Collection
- Specified by:
- addAllin interface- java.util.List
 
 - 
removeAllpublic boolean removeAll(java.util.Collection c) - Specified by:
- removeAllin interface- java.util.Collection
- Specified by:
- removeAllin interface- java.util.List
 
 - 
retainAllpublic boolean retainAll(java.util.Collection c) - Specified by:
- retainAllin interface- java.util.Collection
- Specified by:
- retainAllin interface- java.util.List
 
 - 
clearpublic void clear() - Specified by:
- clearin interface- java.util.Collection
- Specified by:
- clearin interface- java.util.List
 
 - 
addpublic void add(int index, java.lang.Object element)- Specified by:
- addin interface- java.util.List
 
 - 
addAllpublic boolean addAll(int index, java.util.Collection c)- Specified by:
- addAllin interface- java.util.List
 
 - 
setpublic java.lang.Object set(int index, java.lang.Object element)- Specified by:
- setin interface- java.util.List
 
 - 
removepublic java.lang.Object remove(int index) - Specified by:
- removein interface- java.util.List
 
 - 
subListpublic java.util.List subList(int fromIndex, int toIndex)- Specified by:
- subListin interface- java.util.List
 
 - 
findPrototypeIdprotected int findPrototypeId(Symbol k) - Overrides:
- findPrototypeIdin class- IdScriptableObject
 
 - 
findPrototypeIdprotected int findPrototypeId(java.lang.String s) - Overrides:
- findPrototypeIdin class- IdScriptableObject
 
 
- 
 
-