Package org.mozilla.javascript
Class EmbeddedSlotMap
- java.lang.Object
-
- org.mozilla.javascript.EmbeddedSlotMap
-
- All Implemented Interfaces:
java.lang.Iterable<ScriptableObject.Slot>
,SlotMap
public class EmbeddedSlotMap extends java.lang.Object implements SlotMap
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
EmbeddedSlotMap.Iter
-
Field Summary
Fields Modifier and Type Field Description private int
count
private ScriptableObject.Slot
firstAdded
private static int
INITIAL_SLOT_SIZE
private ScriptableObject.Slot
lastAdded
private ScriptableObject.Slot[]
slots
-
Constructor Summary
Constructors Constructor Description EmbeddedSlotMap()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private static void
addKnownAbsentSlot(ScriptableObject.Slot[] addSlots, ScriptableObject.Slot slot)
Add slot with keys that are known to absent from the table.void
addSlot(ScriptableObject.Slot newSlot)
Insert a new slot to the map.private static void
copyTable(ScriptableObject.Slot[] oldSlots, ScriptableObject.Slot[] newSlots)
private ScriptableObject.Slot
createSlot(java.lang.Object key, int indexOrHash, ScriptableObject.SlotAccess accessType, ScriptableObject.Slot existingSlot)
ScriptableObject.Slot
get(java.lang.Object key, int index, ScriptableObject.SlotAccess accessType)
Locate the slot with given name or index.private static int
getSlotIndex(int tableSize, int indexOrHash)
private void
insertNewSlot(ScriptableObject.Slot newSlot)
boolean
isEmpty()
Return whether the map is empty.java.util.Iterator<ScriptableObject.Slot>
iterator()
ScriptableObject.Slot
query(java.lang.Object key, int index)
Locate the slot with the given name or index.void
remove(java.lang.Object key, int index)
Remove the slot at either "key" or "index".int
size()
Return the size of the map.
-
-
-
Field Detail
-
slots
private ScriptableObject.Slot[] slots
-
firstAdded
private ScriptableObject.Slot firstAdded
-
lastAdded
private ScriptableObject.Slot lastAdded
-
count
private int count
-
INITIAL_SLOT_SIZE
private static final int INITIAL_SLOT_SIZE
- See Also:
- Constant Field Values
-
-
Method Detail
-
size
public int size()
Description copied from interface:SlotMap
Return the size of the map.
-
isEmpty
public boolean isEmpty()
Description copied from interface:SlotMap
Return whether the map is empty.
-
iterator
public java.util.Iterator<ScriptableObject.Slot> iterator()
- Specified by:
iterator
in interfacejava.lang.Iterable<ScriptableObject.Slot>
-
query
public ScriptableObject.Slot query(java.lang.Object key, int index)
Locate the slot with the given name or index.
-
get
public ScriptableObject.Slot get(java.lang.Object key, int index, ScriptableObject.SlotAccess accessType)
Locate the slot with given name or index. Depending on the accessType parameter and the current slot status, a new slot may be allocated.
-
createSlot
private ScriptableObject.Slot createSlot(java.lang.Object key, int indexOrHash, ScriptableObject.SlotAccess accessType, ScriptableObject.Slot existingSlot)
-
addSlot
public void addSlot(ScriptableObject.Slot newSlot)
Description copied from interface:SlotMap
Insert a new slot to the map. Both "name" and "indexOrHash" must be populated. Note that ScriptableObject generally adds slots via the "get" method.
-
insertNewSlot
private void insertNewSlot(ScriptableObject.Slot newSlot)
-
remove
public void remove(java.lang.Object key, int index)
Description copied from interface:SlotMap
Remove the slot at either "key" or "index".
-
copyTable
private static void copyTable(ScriptableObject.Slot[] oldSlots, ScriptableObject.Slot[] newSlots)
-
addKnownAbsentSlot
private static void addKnownAbsentSlot(ScriptableObject.Slot[] addSlots, ScriptableObject.Slot slot)
Add slot with keys that are known to absent from the table. This is an optimization to use when inserting into empty table, after table growth or during deserialization.
-
getSlotIndex
private static int getSlotIndex(int tableSize, int indexOrHash)
-
-