Class PHTreeR<T>

    • Method Detail

      • createPHTree

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

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

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

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

        public PHStats getStats()
        Specified by:
        getStats in interface Index<T>
        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<T>
      • getDepth

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

        public String toStringTree()
        Specified by:
        toStringTree in interface Index<T>
        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: RectangleIndex
        Insert a rectangle.
        Specified by:
        insert in interface RectangleIndex<T>
        Parameters:
        lower - minimum corner
        upper - maximum corner
        value - value
      • remove

        public T remove​(double[] lower,
                        double[] upper)
        Description copied from interface: RectangleIndex
        Remove an entry.
        Specified by:
        remove in interface RectangleIndex<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: RectangleIndex
        Update the position of an entry.
        Specified by:
        update in interface RectangleIndex<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
      • queryExact

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

        public QueryIterator<RectangleEntry<T>> queryIntersect​(double[] min,
                                                               double[] max)
        Specified by:
        queryIntersect in interface RectangleIndex<T>
        Parameters:
        min - Lower left corner of the query window
        max - Upper right corner of the query window
        Returns:
        All rectangles that intersect with the query rectangle.
      • queryKNN

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