Interface PointIndexMM<T>

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

    public interface PointIndexMM<T>
    extends Index<T>
    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<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`.
      • query

        QueryIterator<PointEntry<T>> query​(double[] point)
        Lookup an entries at a given coordinate.
        Parameters:
        point - the point
        Returns:
        an iterator over all entries at the given point
      • query

        QueryIterator<PointEntry<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 PointEntryDist<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 QueryIteratorKNN<PointEntryDist<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

        QueryIteratorKNN<PointEntryDist<T>> queryKNN​(double[] center,
                                                     int k,
                                                     PointDistanceFunction 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