Interface SpatialIndex2D<T extends SpatialIndex2Capable>

    • Method Detail

      • add

        void add​(T obj)
        Adds an object to the index
      • remove

        void remove​(T obj)
        Removes an object from the index
      • move

        void move​(T obj,
                  CoordI2 oldPosition,
                  CoordI2 oldDimension)
        Moves an indexed object to a new location. Implementations are usually faster than doing separate remove() and add() operations
      • find

        default Collection<T> find​(RectI2 rect)
        Queries all object intersecting with a given area
      • find

        default List<T> find​(CoordI2 position,
                             CoordI2 dimension)
        Queries all object intersecting with a given area
      • find

        List<T> find​(CoordI2 position,
                     CoordI2 dimension,
                     Predicate<T> filter)
        Queries all object intersecting with a given area. Objects can be pre-filtered which is usually faster than returning them first and then filter in your own code.
      • findFirstAt

        default T findFirstAt​(CoordI2 position)
        Returns the first object at a given position
      • findFirstAt

        T findFirstAt​(CoordI2 position,
                      Predicate<T> filter)
        Returns the first object at a given position. Objects can be pre-filtered which is usually faster than returning them first and then filter in your own code.
      • executeAt

        default void executeAt​(CoordI2 position,
                               Consumer<T> consumer)
        Executes a consumer for all objects at a given position.
      • executeAt

        void executeAt​(CoordI2 position,
                       Consumer<T> consumer,
                       Predicate<T> filter)
        Executes a consumer for all objects at a given position. Objects can be pre-filtered which is usually faster than returning them first and then filter in your own code.
      • close

        void close()
        Clears and frees internal state
        Specified by:
        close in interface AutoCloseable
      • clear

        void clear()
        Clears but keeps internal state allocated. Optimization for re-use.