Interface PointMultimap<T>

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

    public interface PointMultimap<T>
    extends Index
    A common interface for spatial indexes (multimaps) that use points as keys. This interface requires indexes to be multimaps which mean a given keys can exist multiple times and is not overwritten when a new entry with the same key is added.
    • Method Detail

      • insert

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

        boolean remove​(double[] point,
                       T value)
        Remove *one* entry with the given value.
        Parameters:
        point - the point
        value - only entries with this value are removed
        Returns:
        the value of the entry or null if the entry was not found
      • removeIf

        boolean removeIf​(double[] point,
                         Predicate<Index.PointEntry<T>> condition)
        Remove *one* entry with the given condition.
        Parameters:
        point - the point
        condition - the condition required for removing an entry
        Returns:
        the value of the entry or null if the entry was not found
      • update

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

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

        Index.PointIterator<T> queryExactPoint​(double[] point)
        Lookup an entries at a given coordinate.
        Parameters:
        point - the point
        Returns:
        an iterator over all entries at the given point
      • 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

        default 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
      • queryKnn

        Index.PointIteratorKnn<T> queryKnn​(double[] center,
                                           int k,
                                           PointDistance distFn)
        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
        distFn - the point distance function to be used
        Returns:
        list of nearest neighbors