D
- Distance typepublic class GenericDistanceDBIDList<D extends Distance<D>> extends Object implements ModifiableDistanceDBIDResult<D>
Modifier and Type | Class and Description |
---|---|
protected class |
GenericDistanceDBIDList.Iter
Iterator class.
|
Modifier and Type | Field and Description |
---|---|
(package private) ArrayList<DistanceDBIDPair<D>> |
storage
Actual storage.
|
Constructor and Description |
---|
GenericDistanceDBIDList()
Constructor.
|
GenericDistanceDBIDList(int initialCapacity)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
add(D dist,
DBIDRef id)
Add an object to this result.
|
void |
add(DistanceDBIDPair<D> pair)
Add a prepared pair.
|
boolean |
contains(DBIDRef o)
Test whether an ID is contained.
|
DistanceDBIDPair<D> |
get(int off)
Access a single pair.
|
boolean |
isEmpty()
Test for an empty DBID collection.
|
DistanceDBIDResultIter<D> |
iter()
Get an iterator
|
int |
size()
Size of list.
|
void |
sort()
Sort the result in ascending order
|
String |
toString() |
final ArrayList<DistanceDBIDPair<D extends Distance<D>>> storage
public GenericDistanceDBIDList()
public GenericDistanceDBIDList(int initialCapacity)
initialCapacity
- Capacitypublic void add(D dist, DBIDRef id)
ModifiableDistanceDBIDResult
add
in interface ModifiableDistanceDBIDResult<D extends Distance<D>>
dist
- Distance to addid
- DBID to addpublic void add(DistanceDBIDPair<D> pair)
pair
- Pair to addpublic void sort()
ModifiableDistanceDBIDResult
sort
in interface ModifiableDistanceDBIDResult<D extends Distance<D>>
public int size()
DistanceDBIDResult
public DistanceDBIDPair<D> get(int off)
DistanceDBIDResult
get
in interface DistanceDBIDResult<D extends Distance<D>>
off
- Offsetpublic DistanceDBIDResultIter<D> iter()
DistanceDBIDResult
public boolean contains(DBIDRef o)
DBIDs
public boolean isEmpty()
DBIDs