Package org.stianloader.stianknn

# Class SpatialQueryArray<E>

java.lang.Object
org.stianloader.stianknn.SpatialQueryArray<E>

Type Parameters:
  `E` -

All Implemented Interfaces:
  `SpatialIndex1NN<E>`, `SpatialIndexKNN<E>`

public class SpatialQueryArray<@NotNull E> extends Object implements SpatialIndexKNN<E>
Code heavily based on a gist made by someone else.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SpatialQueryArray(Collection<PointObjectPair<@NotNull E>> points, float minX, float minY, float maxX, float maxY, float cellWidth, float cellHeight)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `E`
  `query1nn(float x, float y)`
  `void`
  `queryKnn(float x, float y, int nearestNeighbours, @NotNull Consumer<@NotNull E> out)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### SpatialQueryArray

    public SpatialQueryArray(Collection<PointObjectPair<@NotNull E>> points, float minX, float minY, float maxX, float maxY, float cellWidth, float cellHeight)

- ## Method Details

  - ### query1nn

    @Nullable public E query1nn(float x, float y)
    Specified by:
      `query1nn` in interface `SpatialIndex1NN<E>`

  - ### queryKnn

    public void queryKnn(float x, float y, int nearestNeighbours, @NotNull @NotNull Consumer<@NotNull E> out)
    Specified by:
      `queryKnn` in interface `SpatialIndexKNN<E>`