1 /*
2  * This file is part of ELKI:
3  * Environment for Developing KDD-Applications Supported by Index-Structures
4  *
5  * Copyright (C) 2018
6  * ELKI Development Team
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU Affero General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU Affero General Public License for more details.
17  *
18  * You should have received a copy of the GNU Affero General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 package de.lmu.ifi.dbs.elki.database.ids;
22 
23 /**
24  * Modifiable API for Distance-DBID results
25  *
26  * @author Erich Schubert
27  * @since 0.5.5
28  *
29  * @composed - - - DoubleDBIDPair
30  */
31 public interface ModifiableDoubleDBIDList extends DoubleDBIDList {
32   /**
33    * Add an object to this result.
34    *
35    * @param distance Distance to add
36    * @param id DBID to add
37    */
add(double distance, DBIDRef id)38   void add(double distance, DBIDRef id);
39 
40   /**
41    * Add an element.
42    *
43    * @param pair Pair to add
44    */
add(DoubleDBIDPair pair)45   void add(DoubleDBIDPair pair);
46 
47   /**
48    * Clear the list contents.
49    */
clear()50   void clear();
51 
52   /**
53    * Sort the result in ascending order
54    */
sort()55   void sort();
56 
57   /**
58    * Swap to entries in the list.
59    *
60    * @param i First entry
61    * @param j Second entry
62    */
swap(int i, int j)63   void swap(int i, int j);
64 
65   /**
66    * Remove the entry at position p by shifting the remainder forward.
67    *
68    * @param p Entry offset to remove
69    */
remove(int p)70   void remove(int p);
71 
72   /**
73    * Remove the entry at position p by swapping with the last (not preserving
74    * the order).
75    *
76    * @param p Entry offset to remove
77    */
removeSwap(int p)78   void removeSwap(int p);
79 
80   @Override
iter()81   DoubleDBIDListMIter iter();
82 }