Class PointArray<T>

    • Constructor Detail

      • PointArray

        public PointArray​(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[] key,
                           T value)
        Description copied from interface: PointIndex
        Insert a point.
        Specified by:
        insert in interface PointIndex<T>
        Specified by:
        insert in interface PointIndexMM<T>
        Parameters:
        key - point
        value - value
      • remove

        public boolean remove​(double[] point,
                              T value)
        Description copied from interface: PointIndexMM
        Remove *one* entry with the given value.
        Specified by:
        remove in interface PointIndexMM<T>
        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

        public boolean removeIf​(double[] point,
                                Predicate<PointEntry<T>> condition)
        Description copied from interface: PointIndexMM
        Remove *one* entry with the given condition.
        Specified by:
        removeIf in interface PointIndexMM<T>
        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
      • query

        public QueryIterator<PointEntry<T>> query​(double[] point)
        Description copied from interface: PointIndexMM
        Lookup an entries at a given coordinate.
        Specified by:
        query in interface PointIndexMM<T>
        Parameters:
        point - the point
        Returns:
        an iterator over all entries at the given point
      • queryExact

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

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

        public org.tinspin.index.array.PointArray.AQueryIterator query​(double[] min,
                                                                       double[] max)
        Specified by:
        query in interface PointIndex<T>
        Specified by:
        query in interface PointIndexMM<T>
        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

        public PointEntryDist<T> query1NN​(double[] center)
        Description copied from interface: PointIndex
        Finds the nearest neighbor. This uses euclidean distance. Other distance types can only be specified directly on the index implementations.
        Specified by:
        query1NN in interface PointIndex<T>
        Specified by:
        query1NN in interface PointIndexMM<T>
        Parameters:
        center - center point
        Returns:
        the nearest neighbor
      • queryKNN

        public org.tinspin.index.array.PointArray.AQueryIteratorKNN queryKNN​(double[] center,
                                                                             int k)
        Description copied from interface: PointIndex
        Finds the nearest neighbor. This uses euclidean distance. Other distance types can only be specified directly on the index implementations.
        Specified by:
        queryKNN in interface PointIndex<T>
        Specified by:
        queryKNN in interface PointIndexMM<T>
        Parameters:
        center - center point
        k - number of neighbors
        Returns:
        list of nearest neighbors
      • queryKNN

        public QueryIteratorKNN<PointEntryDist<T>> queryKNN​(double[] center,
                                                            int k,
                                                            PointDistanceFunction distFn)
        Description copied from interface: PointIndexMM
        Finds the nearest neighbor. This uses Euclidean distance. Other distance types can only be specified directly on the index implementations.
        Specified by:
        queryKNN in interface PointIndexMM<T>
        Parameters:
        center - center point
        k - number of neighbors
        distFn - the point distance function to be used
        Returns:
        list of nearest neighbors
      • update

        public T update​(double[] oldPoint,
                        double[] newPoint)
        Description copied from interface: PointIndex
        Update the position of an entry.
        Specified by:
        update in interface PointIndex<T>
        Parameters:
        oldPoint - old position
        newPoint - new position
        Returns:
        the value of the entry or null if the entry was not found
      • update

        public boolean update​(double[] oldPoint,
                              double[] newPoint,
                              T value)
        Description copied from interface: PointIndexMM
        Update the position of an entry.
        Specified by:
        update in interface PointIndexMM<T>
        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
      • remove

        public T remove​(double[] point)
        Description copied from interface: PointIndex
        Remove a point entry.
        Specified by:
        remove in interface PointIndex<T>
        Parameters:
        point - the point
        Returns:
        the value of the entry or null if the entry was not found
      • 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