Class PHTreeR<T>

    • Method Detail

      • createPHTree

        public static <T> PHTreeR<T> createPHTree​(int dims)
      • getDims

        public int getDims()
        Specified by:
        getDims in interface Index
        Returns:
        the number of dimensions
      • size

        public int size()
        Specified by:
        size in interface Index
        Returns:
        the number of entries
      • clear

        public void clear()
        Description copied from interface: Index
        Clear all entries.
        Specified by:
        clear in interface Index
      • getStats

        public PHStats getStats()
        Specified by:
        getStats in interface Index
        Returns:
        Collect and return some index statistics. Note that indexes are not required to fill all fields. Also, individual indexes may use subclasses with additional fields.
      • getNodeCount

        public int getNodeCount()
        Specified by:
        getNodeCount in interface Index
      • getDepth

        public int getDepth()
        Specified by:
        getDepth in interface Index
      • toStringTree

        public String toStringTree()
        Specified by:
        toStringTree in interface Index
        Returns:
        a full string output of the tree structure with all entries
      • insert

        public void insert​(double[] lower,
                           double[] upper,
                           T value)
        Description copied from interface: BoxMap
        Insert a box.
        Specified by:
        insert in interface BoxMap<T>
        Parameters:
        lower - minimum corner
        upper - maximum corner
        value - value
      • remove

        public T remove​(double[] lower,
                        double[] upper)
        Description copied from interface: BoxMap
        Remove an entry.
        Specified by:
        remove in interface BoxMap<T>
        Parameters:
        lower - minimum corner
        upper - maximum corner
        Returns:
        the value of the entry or null if the entry was not found
      • update

        public T update​(double[] lo1,
                        double[] up1,
                        double[] lo2,
                        double[] up2)
        Description copied from interface: BoxMap
        Update the position of an entry.
        Specified by:
        update in interface BoxMap<T>
        Parameters:
        lo1 - old min
        up1 - old max
        lo2 - new min
        up2 - new max
        Returns:
        the value, or null if the entries was not found
      • contains

        public boolean contains​(double[] min,
                                double[] max)
        Description copied from interface: BoxMap
        Lookup an entry, using exact match.
        Specified by:
        contains in interface BoxMap<T>
        Parameters:
        min - minimum corner
        max - maximum corner
        Returns:
        `true` if an entry was found, otherwise `false`.
      • queryExact

        public T queryExact​(double[] lower,
                            double[] upper)
        Description copied from interface: BoxMap
        Lookup an entry, using exact match.
        Specified by:
        queryExact in interface BoxMap<T>
        Parameters:
        lower - minimum corner
        upper - maximum corner
        Returns:
        the value of the entry or null if the entry was not found
      • queryIntersect

        public Index.BoxIterator<T> queryIntersect​(double[] min,
                                                   double[] max)
        Specified by:
        queryIntersect in interface BoxMap<T>
        Parameters:
        min - Lower left corner of the query window
        max - Upper right corner of the query window
        Returns:
        All boxes that intersect with the query rectangle.
      • queryKnn

        public Index.BoxIteratorKnn<T> queryKnn​(double[] center,
                                                int k)
        Description copied from interface: BoxMap
        Finds the nearest neighbor. This uses Euclidean 'edge distance', i.e. the distance to the edge of a box. Distance is 0 if the box overlaps with the search point. Other distance types can only be specified directly on the index implementations.
        Specified by:
        queryKnn in interface BoxMap<T>
        Parameters:
        center - center point
        k - number of neighbors
        Returns:
        list of nearest neighbors