Interface PointMap<T>

  • Type Parameters:
    T - Type of the value associated with the point key.
    All Superinterfaces:
    Index
    All Known Implementing Classes:
    CoverTree, KDTree, PHTreeP, PointArray, PointMapWrapper, QuadTreeKD, QuadTreeKD0, QuadTreeKD2

    public interface PointMap<T>
    extends Index
    A common interface for spatial indexes (maps) that use points as keys. This interface is somewhat inconsistent because it suggests that implementations act as "maps" which means that a given keys can exist only once and is overwritten when a new entry with the same key is added.

    However, most implementations in this library (except for the PH-Tree) act as multimaps which means they allow multiple entries with identical keys.

    • Method Detail

      • insert

        void insert​(double[] key,
                    T value)
        Insert a point.
        Parameters:
        key - point
        value - value
      • remove

        T remove​(double[] point)
        Remove a point entry.
        Parameters:
        point - the point
        Returns:
        the value of the entry or null if the entry was not found
      • update

        T update​(double[] oldPoint,
                 double[] newPoint)
        Update the position of an entry.
        Parameters:
        oldPoint - old position
        newPoint - new position
        Returns:
        the value of the entry or null if the entry was not found
      • contains

        boolean contains​(double[] point)
        Lookup an entry, using exact match.
        Parameters:
        point - the point
        Returns:
        `true` if an entry was found, otherwise `false`.
      • queryExact

        T queryExact​(double[] point)
        Lookup an entry, using exact match.
        Parameters:
        point - the point
        Returns:
        the value of the entry or null if the entry was not found
      • query

        Index.PointIterator<T> query​(double[] min,
                                     double[] max)
        Parameters:
        min - Lower left corner of the query window
        max - Upper right corner of the query window
        Returns:
        All points that lie inside the query rectangle.
      • query1nn

        default Index.PointEntryKnn<T> query1nn​(double[] center)
        Finds the nearest neighbor. This uses Euclidean distance. Other distance types can only be specified directly on the index implementations.
        Parameters:
        center - center point
        Returns:
        the nearest neighbor
      • queryKnn

        Index.PointIteratorKnn<T> queryKnn​(double[] center,
                                           int k)
        Finds the nearest neighbor. This uses Euclidean distance. Other distance types can only be specified directly on the index implementations.
        Parameters:
        center - center point
        k - number of neighbors
        Returns:
        list of nearest neighbors