class DoubleIntegerDBIDArrayList extends java.lang.Object implements ModifiableDoubleDBIDList, DoubleIntegerDBIDList
Modifier and Type | Class and Description |
---|---|
private class |
DoubleIntegerDBIDArrayList.Itr
List iterator.
|
DoubleDBIDList.Consumer
Modifier and Type | Field and Description |
---|---|
(package private) double[] |
dists
Distance values
|
private static double[] |
EMPTY_DISTS
Empty.
|
private static int[] |
EMPTY_IDS
Empty.
|
(package private) int[] |
ids
DBIDs
|
private static int |
INITIAL_SIZE
Initial size allocation.
|
(package private) int |
size
The size
|
Modifier | Constructor and Description |
---|---|
protected |
DoubleIntegerDBIDArrayList()
Constructor.
|
protected |
DoubleIntegerDBIDArrayList(int size)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(DoubleDBIDPair pair)
Add an element.
|
void |
add(double dist,
DBIDRef id)
Add an object to this result.
|
protected void |
addInternal(double dist,
int id)
Add an entry, consisting of distance and internal index.
|
DBIDVar |
assignVar(int index,
DBIDVar var)
Assign a DBID variable the value of position
index . |
void |
clear()
Clear the list contents.
|
boolean |
contains(DBIDRef o)
Test whether an ID is contained.
|
double |
doubleValue(int index)
Get the double value at a given index (to access the DBID, either use
DoubleDBIDList.iter() or DoubleDBIDList.assignVar(int, de.lmu.ifi.dbs.elki.database.ids.DBIDVar) . |
protected void |
grow()
Grow the data storage.
|
DoubleIntegerDBIDArrayList.Itr |
iter()
Get a DBID iterator (a more efficient API).
|
void |
remove(int index)
Remove the entry at position p by shifting the remainder forward.
|
void |
removeSwap(int index)
Remove the entry at position p by swapping with the last (not preserving
the order).
|
protected void |
reverse()
Reverse the list.
|
int |
size()
Retrieve the collection / data size.
|
DoubleIntegerDBIDList |
slice(int begin,
int end)
Get a subset list.
|
void |
sort()
Sort the result in ascending order
|
void |
swap(int i,
int j)
Swap to entries in the list.
|
java.lang.String |
toString() |
void |
truncate(int newsize)
Truncate the list to the given size, freeing the memory.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
forEachDouble
private static final int INITIAL_SIZE
int size
double[] dists
int[] ids
private static final double[] EMPTY_DISTS
private static final int[] EMPTY_IDS
protected DoubleIntegerDBIDArrayList()
protected DoubleIntegerDBIDArrayList(int size)
size
- Initial sizepublic DoubleIntegerDBIDArrayList.Itr iter()
DBIDs
Example:
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
DBID id = iter.getDBID();
}
iter
in interface DBIDs
iter
in interface DoubleDBIDList
iter
in interface DoubleIntegerDBIDList
iter
in interface IntegerDBIDs
iter
in interface ModifiableDoubleDBIDList
public boolean contains(DBIDRef o)
DBIDs
public int size()
DBIDs
size
in interface DBIDs
size
in interface DoubleDBIDList
public DBIDVar assignVar(int index, DBIDVar var)
DoubleDBIDList
index
.assignVar
in interface DoubleDBIDList
index
- Positionvar
- Variable to assign the value to.public double doubleValue(int index)
DoubleDBIDList
DoubleDBIDList.iter()
or DoubleDBIDList.assignVar(int, de.lmu.ifi.dbs.elki.database.ids.DBIDVar)
.doubleValue
in interface DoubleDBIDList
index
- Indexprotected void addInternal(double dist, int id)
dist
- Distanceid
- Internal indexprotected void grow()
public void add(double dist, DBIDRef id)
ModifiableDoubleDBIDList
add
in interface ModifiableDoubleDBIDList
dist
- Distance to addid
- DBID to addpublic void add(DoubleDBIDPair pair)
ModifiableDoubleDBIDList
add
in interface ModifiableDoubleDBIDList
pair
- Pair to addpublic void clear()
ModifiableDoubleDBIDList
clear
in interface ModifiableDoubleDBIDList
public void sort()
ModifiableDoubleDBIDList
sort
in interface ModifiableDoubleDBIDList
protected void reverse()
public void remove(int index)
ModifiableDoubleDBIDList
remove
in interface ModifiableDoubleDBIDList
index
- Entry offset to removepublic void removeSwap(int index)
ModifiableDoubleDBIDList
removeSwap
in interface ModifiableDoubleDBIDList
index
- Entry offset to removepublic void swap(int i, int j)
ModifiableDoubleDBIDList
swap
in interface ModifiableDoubleDBIDList
i
- First entryj
- Second entrypublic void truncate(int newsize)
newsize
- New sizepublic DoubleIntegerDBIDList slice(int begin, int end)
DoubleDBIDList
slice
in interface DoubleDBIDList
slice
in interface DoubleIntegerDBIDList
begin
- Beginend
- Endpublic java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2019 ELKI Development Team. License information.