final class IntegerDBIDRange extends java.lang.Object implements IntegerDBIDs, DBIDRange, SetDBIDs
Modifier and Type | Class and Description |
---|---|
private static class |
IntegerDBIDRange.Itr
Iterator in ELKI/C++ style.
|
Modifier and Type | Field and Description |
---|---|
protected int |
len
Length value.
|
protected int |
start
Start value.
|
Modifier | Constructor and Description |
---|---|
protected |
IntegerDBIDRange(int start,
int len)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
DBIDVar |
assignVar(int index,
DBIDVar var)
Assign a DBID variable the value of position
index . |
int |
binarySearch(DBIDRef key)
Search for the position of the given key, assuming that the data set is
sorted.
|
boolean |
contains(DBIDRef o)
Test whether an ID is contained.
|
DBID |
get(int i)
Get the i'th entry (starting at 0)
If possible, use an
DBIDArrayIter via ArrayDBIDs.iter() instead, or
an DBIDVar via ArrayDBIDs.assignVar(int, de.lmu.ifi.dbs.elki.database.ids.DBIDVar) |
int |
getOffset(DBIDRef dbid)
For storage array offsets.
|
IntegerDBIDRange.Itr |
iter()
Get a DBID iterator (a more efficient API).
|
int |
mapDBIDToOffset(DBIDRef dbid)
Map a DBID to an array offset.
|
int |
size()
Retrieve the collection / data size.
|
ArrayDBIDs |
slice(int begin,
int end)
Slice a subarray (as view, not copy!)
|
java.lang.String |
toString() |
protected IntegerDBIDRange(int start, int len)
start
- Range startlen
- Range lengthpublic int size()
DBIDs
size
in interface ArrayDBIDs
size
in interface DBIDs
public boolean contains(DBIDRef o)
DBIDs
public DBID get(int i)
ArrayDBIDs
If possible, use an DBIDArrayIter
via ArrayDBIDs.iter()
instead, or
an DBIDVar
via ArrayDBIDs.assignVar(int, de.lmu.ifi.dbs.elki.database.ids.DBIDVar)
get
in interface ArrayDBIDs
i
- Indexpublic int getOffset(DBIDRef dbid)
public DBIDVar assignVar(int index, DBIDVar var)
ArrayDBIDs
index
.assignVar
in interface ArrayDBIDs
index
- Positionvar
- Variable to assign the value to.public int binarySearch(DBIDRef key)
ArrayDBIDs
For keys not found, -(1+insertion position)
is returned, as
for Java Collections.binarySearch(java.util.List<? extends java.lang.Comparable<? super T>>, T)
binarySearch
in interface ArrayDBIDs
key
- Key to search forpublic java.lang.String toString()
toString
in class java.lang.Object
public int mapDBIDToOffset(DBIDRef dbid)
DataStoreIDMap
mapDBIDToOffset
in interface DataStoreIDMap
dbid
- DBIDid >= 0
public ArrayDBIDs slice(int begin, int end)
ArrayDBIDs
slice
in interface ArrayDBIDs
begin
- Begin (inclusive)end
- End (exclusive)public IntegerDBIDRange.Itr iter()
DBIDs
Example:
for(DBIDIter iter = ids.iter(); iter.valid(); iter.advance()) {
DBID id = iter.getDBID();
}
iter
in interface ArrayDBIDs
iter
in interface DBIDs
iter
in interface IntegerDBIDs
Copyright © 2019 ELKI Development Team. License information.