org.mozilla.javascript

Class NativeArray

Implemented Interfaces:
ConstProperties, DebuggableObject, IdFunctionCall, Scriptable, Serializable

public class NativeArray
extends IdScriptableObject

This class implements the Array native object.
Authors:
Norris Boyd
Mike McCabe

Field Summary

Fields inherited from class org.mozilla.javascript.ScriptableObject

CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST

Fields inherited from interface org.mozilla.javascript.Scriptable

NOT_FOUND

Constructor Summary

NativeArray(Object[] array)
NativeArray(long lengthArg)

Method Summary

void
delete(int index)
Object
execIdCall(IdFunctionObject f, Context cx, Scriptable scope, Scriptable thisObj, Object[] args)
'thisObj' will be null if invoked as constructor, in which case instance of Scriptable should be returned.
protected void
fillConstructorProperties(IdFunctionObject ctor)
protected int
findInstanceIdInfo(String s)
Map name to id of instance property.
protected int
findPrototypeId(String s)
Object
get(int index, Scriptable start)
String
getClassName()
Object
getDefaultValue(Class hint)
Object[]
getIds()
protected String
getInstanceIdName(int id)
Map id back to property name it defines.
protected Object
getInstanceIdValue(int id)
Get id value.
long
getLength()
protected int
getMaxInstanceId()
Get maximum id findInstanceIdInfo can generate.
boolean
has(int index, Scriptable start)
protected void
initPrototypeId(int id)
long
jsGet_length()
Deprecated. Use getLength() instead.
void
put(String id, Scriptable start, Object value)
void
put(int index, Scriptable start, Object value)
protected void
setInstanceIdValue(int id, Object value)
Set or delete id value.

Methods inherited from class org.mozilla.javascript.IdScriptableObject

activatePrototypeMap, addIdFunctionProperty, defaultGet, defaultPut, delete, execIdCall, exportAsJSClass, fillConstructorProperties, findInstanceIdInfo, findPrototypeId, get, getAttributes, getInstanceIdName, getInstanceIdValue, getMaxInstanceId, has, hasPrototypeMap, incompatibleCallError, initPrototypeConstructor, initPrototypeId, initPrototypeMethod, initPrototypeValue, instanceIdInfo, put, setAttributes, setInstanceIdValue

Methods inherited from class org.mozilla.javascript.ScriptableObject

associateValue, avoidObjectDetection, callMethod, callMethod, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, deleteProperty, deleteProperty, equivalentValues, get, get, getAllIds, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getClassName, getClassPrototype, getDefaultValue, getDefaultValue, getFunctionPrototype, getGetterOrSetter, getIds, getObjectPrototype, getParentScope, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, has, has, hasInstance, hasProperty, hasProperty, isConst, isGetterOrSetter, isSealed, put, put, putConst, putConstProperty, putProperty, putProperty, redefineProperty, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setGetterOrSetter, setParentScope, setPrototype

Constructor Details

NativeArray

public NativeArray(Object[] array)

NativeArray

public NativeArray(long lengthArg)

Method Details

delete

public void delete(int index)
Specified by:
delete in interface Scriptable
Overrides:
delete in interface ScriptableObject

execIdCall

public Object execIdCall(IdFunctionObject f,
                         Context cx,
                         Scriptable scope,
                         Scriptable thisObj,
                         Object[] args)
'thisObj' will be null if invoked as constructor, in which case instance of Scriptable should be returned.
Specified by:
execIdCall in interface IdFunctionCall
Overrides:
execIdCall in interface IdScriptableObject

fillConstructorProperties

protected void fillConstructorProperties(IdFunctionObject ctor)
Overrides:
fillConstructorProperties in interface IdScriptableObject

findInstanceIdInfo

protected int findInstanceIdInfo(String s)
Overrides:
findInstanceIdInfo in interface IdScriptableObject

findPrototypeId

protected int findPrototypeId(String s)
Overrides:
findPrototypeId in interface IdScriptableObject

get

public Object get(int index,
                  Scriptable start)
Specified by:
get in interface Scriptable
Overrides:
get in interface ScriptableObject

getClassName

public String getClassName()
Specified by:
getClassName in interface Scriptable
Overrides:
getClassName in interface ScriptableObject

getDefaultValue

public Object getDefaultValue(Class hint)
Specified by:
getDefaultValue in interface Scriptable
Overrides:
getDefaultValue in interface ScriptableObject

getIds

public Object[] getIds()
Specified by:
getIds in interface Scriptable
Overrides:
getIds in interface ScriptableObject

getInstanceIdName

protected String getInstanceIdName(int id)
Map id back to property name it defines.
Overrides:
getInstanceIdName in interface IdScriptableObject

getInstanceIdValue

protected Object getInstanceIdValue(int id)
Get 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:
getInstanceIdValue in interface IdScriptableObject

getLength

public long getLength()

getMaxInstanceId

protected int getMaxInstanceId()
Get maximum id findInstanceIdInfo can generate.
Overrides:
getMaxInstanceId in interface IdScriptableObject

has

public boolean has(int index,
                   Scriptable start)
Specified by:
has in interface Scriptable
Overrides:
has in interface ScriptableObject

initPrototypeId

protected void initPrototypeId(int id)
Overrides:
initPrototypeId in interface IdScriptableObject

jsGet_length

public long jsGet_length()

Deprecated. Use getLength() instead.


put

public void put(String id,
                Scriptable start,
                Object value)
Specified by:
put in interface Scriptable
Overrides:
put in interface IdScriptableObject

put

public void put(int index,
                Scriptable start,
                Object value)
Specified by:
put in interface Scriptable
Overrides:
put in interface ScriptableObject

setInstanceIdValue

protected void setInstanceIdValue(int id,
                                  Object value)
Set or delete id value. If value == NOT_FOUND , the implementation should make sure that the following getInstanceIdValue return NOT_FOUND.
Overrides:
setInstanceIdValue in interface IdScriptableObject