Interface ArrayModifiableDBIDs

    • Method Detail

      • sort

        void sort()
        Sort the DBID set.
      • sort

        void sort​(java.util.Comparator<? super DBIDRef> comparator)
        Sort the DBID set.
        Parameters:
        comparator - Comparator to use
      • sort

        void sort​(int start,
                  int end,
                  java.util.Comparator<? super DBIDRef> comparator)
        Sort the DBID set.
        Parameters:
        start - Starting index, for partial sorting
        end - End index, for partial sorting (exclusive)
        comparator - Comparator to use
      • remove

        void remove​(int i)
        Remove the entry at position i by shifting the remainder forward.
        Parameters:
        i - Index
      • removeSwap

        void removeSwap​(int i)
        Remove the entry at position i by swapping with the last (not preserving the order).
        Parameters:
        i - Entry offset to remove
      • set

        void set​(int i,
                 DBIDRef newval)
        Replace the i'th entry (starting at 0)
        Parameters:
        i - Index
        newval - New value
      • insert

        void insert​(int i,
                    DBIDRef newval)
        Insert at position i (starting at 0, moving the remainder by one position).

        Note: this operation has linear time complexity on average: O(n/2)

        Parameters:
        i - Index
        newval - New value
      • swap

        void swap​(int a,
                  int b)
        Swap DBIDs add positions a and b.
        Parameters:
        a - First position
        b - Second position
      • iter

        DBIDArrayMIter iter()
        Description copied from interface: ModifiableDBIDs
        Get a modifiable DBID iterator (a more efficient API).

        usage example:

         
         for(DBIDMIter iter = ids.iter(); iter.valid(); iter.advance()) {
           DBID id = iter.getDBID();
           iter.remove();
         }
         
         
        Specified by:
        iter in interface ArrayDBIDs
        Specified by:
        iter in interface DBIDs
        Specified by:
        iter in interface ModifiableDBIDs
        Returns:
        modifiable iterator