Interface SectionContainer<S extends Tracked<K>,K extends WorldKey>

Type Parameters:
S - the type of elements stored in the container, which must implement the Tracked interface
K - the type of key associated with each element, which must extend WorldKey
All Known Implementing Classes:
ArraySectionContainer, DynamicSectionContainer, MapContainer

public interface SectionContainer<S extends Tracked<K>,K extends WorldKey>
Represents a container for managing sections of data associated with spatial positions. Provides methods for accessing, modifying, and retrieving the elements within the container. This container works with elements that are Tracked and are associated with a key implementing WorldKey.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Copies every entry from this container into the given target container.
    get(int position)
    Retrieves the holder stored at the given position.
    it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<Holder<S,K>>
     
    default boolean
     
    void
    set(int position, Holder<S,K> holder)
    Stores or clears the holder at the given position.
    default int
     
  • Method Details

    • get

      Holder<S,K> get(int position)
      Retrieves the holder stored at the given position.
      Parameters:
      position - the index to look up
      Returns:
      the holder at the position, or null if empty
    • set

      void set(int position, Holder<S,K> holder)
      Stores or clears the holder at the given position.
      Parameters:
      position - the index to store the holder at
      holder - the holder to store, or null to clear the position
    • getAll

      it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap<Holder<S,K>> getAll()
      Returns:
      a map of position to holder for every non-null entry in this container
    • size

      default int size()
      Returns:
      the number of occupied positions in this container
    • isEmpty

      default boolean isEmpty()
      Returns:
      true if no positions are currently occupied
    • copyTo

      default void copyTo(SectionContainer<S,K> target)
      Copies every entry from this container into the given target container.
      Parameters:
      target - the container to copy entries into