public class DoubleDistanceIntegerDBIDList extends Object implements ModifiableDoubleDistanceDBIDList, IntegerDBIDs
Modifier and Type | Class and Description |
---|---|
private class |
DoubleDistanceIntegerDBIDList.Itr
List iterator.
|
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
|
Constructor and Description |
---|
DoubleDistanceIntegerDBIDList()
Constructor.
|
DoubleDistanceIntegerDBIDList(int size)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(double dist,
DBIDRef id)
Add an element.
|
void |
add(DoubleDistanceDBIDPair pair)
Add an element.
|
void |
add(DoubleDistance dist,
DBIDRef id)
Deprecated.
|
protected void |
addInternal(double dist,
int id)
Add an entry, consisting of distance and internal index.
|
void |
clear()
Clear the list contents.
|
boolean |
contains(DBIDRef o)
Test whether an ID is contained.
|
DoubleDistanceIntegerDBIDPair |
get(int index)
Access a single pair.
|
double |
getDoubleDistance(int pos)
Get the distance of the object at position pos.
|
protected void |
grow()
Grow the data storage.
|
boolean |
isEmpty()
Test for an empty DBID collection.
|
DoubleDistanceIntegerDBIDList.Itr |
iter()
Get an iterator
|
protected void |
reverse()
Reverse the list.
|
int |
size()
Size of list.
|
void |
sort()
Sort the result in ascending order
|
String |
toString() |
void |
truncate(int newsize)
Truncate the list to the given size.
|
private static final int INITIAL_SIZE
int size
double[] dists
int[] ids
private static final double[] EMPTY_DISTS
private static final int[] EMPTY_IDS
public DoubleDistanceIntegerDBIDList()
public DoubleDistanceIntegerDBIDList(int size)
size
- Initial sizepublic DoubleDistanceIntegerDBIDList.Itr iter()
DistanceDBIDList
iter
in interface DBIDs
iter
in interface DistanceDBIDList<DoubleDistance>
iter
in interface DoubleDistanceDBIDList
iter
in interface IntegerDBIDs
public boolean contains(DBIDRef o)
DBIDs
public boolean isEmpty()
DBIDs
public int size()
DistanceDBIDList
size
in interface DBIDs
size
in interface DistanceDBIDList<DoubleDistance>
public DoubleDistanceIntegerDBIDPair get(int index)
DistanceDBIDList
get
in interface DistanceDBIDList<DoubleDistance>
get
in interface DoubleDistanceDBIDList
index
- Offsetprotected void addInternal(double dist, int id)
dist
- Distanceid
- Internal indexprotected void grow()
@Deprecated public void add(DoubleDistance dist, DBIDRef id)
ModifiableDoubleDistanceDBIDList
add
in interface ModifiableDistanceDBIDList<DoubleDistance>
add
in interface ModifiableDoubleDistanceDBIDList
dist
- Distanceid
- IDpublic void add(double dist, DBIDRef id)
ModifiableDoubleDistanceDBIDList
add
in interface ModifiableDoubleDistanceDBIDList
dist
- Distanceid
- IDpublic void add(DoubleDistanceDBIDPair pair)
ModifiableDoubleDistanceDBIDList
add
in interface ModifiableDoubleDistanceDBIDList
pair
- Pair to addpublic void clear()
ModifiableDoubleDistanceDBIDList
clear
in interface ModifiableDoubleDistanceDBIDList
public void sort()
ModifiableDistanceDBIDList
sort
in interface ModifiableDistanceDBIDList<DoubleDistance>
protected void reverse()
public void truncate(int newsize)
newsize
- New sizepublic double getDoubleDistance(int pos)
pos
- Position