Package elki.database.ids
Interface ArrayModifiableDBIDs
-
- All Superinterfaces:
ArrayDBIDs
,DBIDs
,ModifiableDBIDs
- All Known Implementing Classes:
ArrayModifiableIntegerDBIDs
public interface ArrayModifiableDBIDs extends ModifiableDBIDs, ArrayDBIDs
Array-oriented implementation of a modifiable DBID collection.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ArrayModifiableDBIDs
clear()
Clear this collection.void
insert(int i, DBIDRef newval)
Insert at position i (starting at 0, moving the remainder by one position).DBIDArrayMIter
iter()
Get a modifiable DBID iterator (a more efficient API).void
remove(int i)
Remove the entry at position i by shifting the remainder forward.void
removeSwap(int i)
Remove the entry at position i by swapping with the last (not preserving the order).void
set(int i, DBIDRef newval)
Replace the i'th entry (starting at 0)void
sort()
Sort the DBID set.void
sort(int start, int end, java.util.Comparator<? super DBIDRef> comparator)
Sort the DBID set.void
sort(java.util.Comparator<? super DBIDRef> comparator)
Sort the DBID set.void
swap(int a, int b)
Swap DBIDs add positions a and b.-
Methods inherited from interface elki.database.ids.ArrayDBIDs
assignVar, binarySearch, get, size, slice
-
Methods inherited from interface elki.database.ids.ModifiableDBIDs
add, addDBIDs, pop, remove, removeDBIDs
-
-
-
-
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 sortingend
- End index, for partial sorting (exclusive)comparator
- Comparator to use
-
clear
ArrayModifiableDBIDs clear()
Description copied from interface:ModifiableDBIDs
Clear this collection.- Specified by:
clear
in interfaceModifiableDBIDs
-
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
- Indexnewval
- 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
- Indexnewval
- New value
-
swap
void swap(int a, int b)
Swap DBIDs add positions a and b.- Parameters:
a
- First positionb
- 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 interfaceArrayDBIDs
- Specified by:
iter
in interfaceDBIDs
- Specified by:
iter
in interfaceModifiableDBIDs
- Returns:
- modifiable iterator
-
-