public final class SparseArray extends DynamicArray
DynamicArray.DynamicArrayCacheScriptArray.CreateWritableProfileAccess, ScriptArray.DefaultIterator, ScriptArray.SetLengthProfileAccesscache, INTEGRITY_LEVEL_FROZEN, INTEGRITY_LEVEL_FROZEN_LENGTH_READONLY, INTEGRITY_LEVEL_MASK, INTEGRITY_LEVEL_NONE, INTEGRITY_LEVEL_NONE_LENGTH_READONLY, INTEGRITY_LEVEL_NOT_EXTENSIBLE, INTEGRITY_LEVEL_NOT_EXTENSIBLE_LENGTH_READONLY, INTEGRITY_LEVEL_SEALED, INTEGRITY_LEVEL_SEALED_LENGTH_READONLY, INTEGRITY_LEVELS, integrityLevel, LENGTH_NOT_WRITABLE, LENGTH_WRITABLE_MASKEMPTY_OBJECT_ARRAY| Modifier and Type | Method and Description |
|---|---|
ScriptArray |
addRangeImpl(JSDynamicObject object,
long offset,
int size)
This method grows the array by adding more elements of a given size.
|
Object |
cloneArray(JSDynamicObject object) |
protected static void |
copyArrayToMap(JSDynamicObject object,
ScriptArray fromArray,
Map<Long,Object> toMap) |
static TreeMap<Long,Object> |
createArrayMap() |
static SparseArray |
createSparseArray() |
ScriptArray |
deleteElementImpl(JSDynamicObject object,
long index,
boolean strict) |
long |
firstElementIndex(JSDynamicObject object)
First element index (inclusive).
|
Object |
getElement(JSDynamicObject object,
long index) |
Object |
getElementInBounds(JSDynamicObject object,
long index) |
boolean |
hasElement(JSDynamicObject object,
long index) |
boolean |
hasHoles(JSDynamicObject object) |
boolean |
isHolesType()
Returns true when the this array could have hole values in it.
|
long |
lastElementIndex(JSDynamicObject object)
Last element index (inclusive).
|
long |
length(JSDynamicObject object) |
int |
lengthInt(JSDynamicObject object) |
static SparseArray |
makeSparseArray(JSDynamicObject object,
ScriptArray fromArray) |
long |
nextElementIndex(JSDynamicObject object,
long index)
Returns the next index.
|
List<Object> |
ownPropertyKeys(JSDynamicObject object) |
long |
previousElementIndex(JSDynamicObject object,
long index)
Returns the previous index.
|
ScriptArray |
removeRangeImpl(JSDynamicObject object,
long start,
long end)
This function deletes all elements in the range from [start..end[.
|
ScriptArray |
setElementImpl(JSDynamicObject object,
long index,
Object value,
boolean strict) |
SparseArray |
setLengthImpl(JSDynamicObject object,
long len,
com.oracle.truffle.api.nodes.Node node,
ScriptArray.SetLengthProfileAccess profile) |
protected DynamicArray |
withIntegrityLevel(int newIntegrityLevel) |
createCache, freeze, isExtensible, isFrozen, isLengthNotWritable, isSealed, maybePreinitializeCache, preventExtensions, seal, setIntegrityLevel, setLengthNotWritable, toStringaddRange, asIterable, canDeleteElement, cast, createConstantArray, createConstantEmptyArray, deleteElement, isInBoundsFast, isInstance, makeMultiRangeList, makeRangeList, nextPower, ownPropertyKeysContiguous, ownPropertyKeysHoles, removeRange, removeRange, setElement, setLength, setLength, shiftRange, shiftRangeImpl, toArray, toString, traceArrayTransition, traceWrite, valueIsBytepublic static SparseArray createSparseArray()
public static SparseArray makeSparseArray(JSDynamicObject object, ScriptArray fromArray)
protected static void copyArrayToMap(JSDynamicObject object, ScriptArray fromArray, Map<Long,Object> toMap)
public Object getElement(JSDynamicObject object, long index)
getElement in class ScriptArraypublic Object getElementInBounds(JSDynamicObject object, long index)
getElementInBounds in class ScriptArraypublic ScriptArray setElementImpl(JSDynamicObject object, long index, Object value, boolean strict)
setElementImpl in class ScriptArraypublic long length(JSDynamicObject object)
length in class ScriptArraypublic int lengthInt(JSDynamicObject object)
lengthInt in class ScriptArraypublic SparseArray setLengthImpl(JSDynamicObject object, long len, com.oracle.truffle.api.nodes.Node node, ScriptArray.SetLengthProfileAccess profile)
setLengthImpl in class ScriptArraypublic long firstElementIndex(JSDynamicObject object)
ScriptArrayfirstElementIndex in class ScriptArraypublic long lastElementIndex(JSDynamicObject object)
ScriptArraylastElementIndex in class ScriptArraypublic long nextElementIndex(JSDynamicObject object, long index)
ScriptArraynextElementIndex in class ScriptArraypublic long previousElementIndex(JSDynamicObject object, long index)
ScriptArraypreviousElementIndex in class ScriptArraypublic Object cloneArray(JSDynamicObject object)
cloneArray in class DynamicArraypublic ScriptArray deleteElementImpl(JSDynamicObject object, long index, boolean strict)
deleteElementImpl in class ScriptArraypublic boolean hasElement(JSDynamicObject object, long index)
hasElement in class ScriptArraypublic boolean isHolesType()
ScriptArrayisHolesType in class ScriptArraypublic boolean hasHoles(JSDynamicObject object)
hasHoles in class ScriptArraypublic ScriptArray removeRangeImpl(JSDynamicObject object, long start, long end)
ScriptArrayremoveRangeImpl in class ScriptArraypublic ScriptArray addRangeImpl(JSDynamicObject object, long offset, int size)
ScriptArrayaddRangeImpl in class ScriptArrayoffset - starting offset positionsize - size of the inserted empty arrayScriptArray instance with the new sizepublic List<Object> ownPropertyKeys(JSDynamicObject object)
ownPropertyKeys in class ScriptArrayprotected DynamicArray withIntegrityLevel(int newIntegrityLevel)
withIntegrityLevel in class DynamicArray