Class RectArray<T>

    • Constructor Detail

      • RectArray

        public RectArray​(int dims,
                         int size)
        Setup of an simple array data structure (no indexing).
        Parameters:
        dims - dimensions
        size - size
    • Method Detail

      • 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>
        Specified by:
        insert in interface RectangleIndexMM<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
      • remove

        public boolean remove​(double[] lower,
                              double[] upper,
                              T value)
        Description copied from interface: RectangleIndexMM
        Remove *one*n entry with the given value.
        Specified by:
        remove in interface RectangleIndexMM<T>
        Parameters:
        lower - minimum corner
        upper - maximum corner
        value - value
        Returns:
        the value of the entry or null if the entry was not found
      • removeIf

        public boolean removeIf​(double[] lower,
                                double[] upper,
                                Predicate<RectangleEntry<T>> condition)
        Description copied from interface: RectangleIndexMM
        Remove *one* entry with the given condition.
        Specified by:
        removeIf in interface RectangleIndexMM<T>
        Parameters:
        lower - minimum corner
        upper - maximum corner
        condition - the condition required for removing an entry
        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
      • update

        public boolean update​(double[] lo1,
                              double[] up1,
                              double[] lo2,
                              double[] up2,
                              T value)
        Description copied from interface: RectangleIndexMM
        Update the position of an entry.
        Specified by:
        update in interface RectangleIndexMM<T>
        Parameters:
        lo1 - old min
        up1 - old max
        lo2 - new min
        up2 - new max
        value - only entries with this value are updated
        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
      • contains

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

        public QueryIterator<RectangleEntry<T>> queryRectangle​(double[] lower,
                                                               double[] upper)
        Description copied from interface: RectangleIndexMM
        Lookup an entry, using exact match.
        Specified by:
        queryRectangle in interface RectangleIndexMM<T>
        Parameters:
        lower - minimum corner
        upper - maximum corner
        Returns:
        an iterator over all entries at with the exact given rectangle
      • query1NN

        public RectangleEntryDist<T> query1NN​(double[] center)
        Description copied from interface: RectangleIndex
        Finds the nearest neighbor. This uses euclidean 'edge distance'. Other distance types can only be specified directly on the index implementations.
        Specified by:
        query1NN in interface RectangleIndex<T>
        Specified by:
        query1NN in interface RectangleIndexMM<T>
        Parameters:
        center - center point
        Returns:
        the nearest neighbor
      • 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>
        Specified by:
        queryKNN in interface RectangleIndexMM<T>
        Parameters:
        center - center point
        k - number of neighbors
        Returns:
        list of nearest neighbors
      • 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 Stats 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