Class EmbeddedSlotMap<T extends PropHolder<T>>

java.lang.Object
org.htmlunit.corejs.javascript.EmbeddedSlotMap<T>
All Implemented Interfaces:
Iterable<Slot<T>>, SlotMap<T>

public class EmbeddedSlotMap<T extends PropHolder<T>> extends Object implements SlotMap<T>
  • Constructor Details

    • EmbeddedSlotMap

      public EmbeddedSlotMap()
    • EmbeddedSlotMap

      public EmbeddedSlotMap(int capacity)
    • EmbeddedSlotMap

      protected EmbeddedSlotMap(EmbeddedSlotMap<T> other)
  • Method Details

    • size

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

      public boolean isEmpty()
      Description copied from interface: SlotMap
      Return whether the map is empty.
      Specified by:
      isEmpty in interface SlotMap<T extends PropHolder<T>>
    • iterator

      public Iterator<Slot<T>> iterator()
      Specified by:
      iterator in interface Iterable<T extends PropHolder<T>>
    • query

      public Slot<T> query(Object key, int index)
      Locate the slot with the given name or index.
      Specified by:
      query in interface SlotMap<T extends PropHolder<T>>
      Parameters:
      key - The key for the slot, which should be a String or a Symbol.
      index - if key is zero, then this will be used as the key instead.
      Returns:
      either the Slot that matched the key and index, or null
    • modify

      public Slot<T> modify(SlotMapOwner<T> owner, Object key, int index, int attributes)
      Locate the slot with given name or index, and create a new one if necessary.
      Specified by:
      modify in interface SlotMap<T extends PropHolder<T>>
      Parameters:
      key - either a String or a Symbol object that identifies the property
      index - index or 0 if slot holds property name.
      attributes - the attributes to be set on the slot if a new slot is created. Existing slots will not be modified.
      Returns:
      a Slot, which will be created anew if no such slot exists.
    • promoteMap

      protected void promoteMap(SlotMapOwner<T> owner, Slot<T> newSlot)
    • compute

      public <S extends Slot<T>> S compute(SlotMapOwner<T> owner, CompoundOperationMap<T> compoundOp, Object key, int index, SlotMap.SlotComputer<S,T> c)
      Specified by:
      compute in interface SlotMap<T extends PropHolder<T>>
    • add

      public void add(SlotMapOwner<T> owner, Slot<T> 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 "modify" method.
      Specified by:
      add in interface SlotMap<T extends PropHolder<T>>
    • copyMap

      public SlotMap<T> copyMap()
      Specified by:
      copyMap in interface SlotMap<T extends PropHolder<T>>