Class EmbeddedSlotMap

    • Constructor Detail

      • EmbeddedSlotMap

        public EmbeddedSlotMap()
    • Method Detail

      • size

        public int size()
        Description copied from interface: SlotMap
        Return the size of the map.
        Specified by:
        size in interface SlotMap
      • isEmpty

        public boolean isEmpty()
        Description copied from interface: SlotMap
        Return whether the map is empty.
        Specified by:
        isEmpty in interface SlotMap
      • query

        public ScriptableObject.Slot query​(java.lang.Object key,
                                           int index)
        Locate the slot with the given name or index.
        Specified by:
        query in interface SlotMap
      • 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.
        Specified by:
        get in interface SlotMap
        Parameters:
        key - either a String or a Symbol object that identifies the property
        index - index or 0 if slot holds property name.
      • 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.
        Specified by:
        addSlot in interface SlotMap
      • remove

        public void remove​(java.lang.Object key,
                           int index)
        Description copied from interface: SlotMap
        Remove the slot at either "key" or "index".
        Specified by:
        remove in interface SlotMap
      • 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)