
final class IntegerDBID extends Object implements DBID, IntegerDBIDRef
long, it should not require
changes in too many places!)
In particular, a developer should not make any assumption of these IDs being
consistent across multiple results/databases.| Modifier and Type | Class and Description |
|---|---|
static class |
IntegerDBID.DynamicSerializer
Dynamic sized serializer, using varint.
|
protected class |
IntegerDBID.Itr
Pseudo iterator for DBIDs interface.
|
static class |
IntegerDBID.StaticSerializer
Static sized serializer, using regular integers.
|
| Modifier and Type | Field and Description |
|---|---|
static ByteBufferSerializer<DBID> |
DYNAMIC_SERIALIZER
The public instance to use for dynamic serialization.
|
protected int |
id
The actual object ID.
|
static FixedSizeByteBufferSerializer<DBID> |
STATIC_SERIALIZER
The public instance to use for static serialization.
|
| Modifier | Constructor and Description |
|---|---|
protected |
IntegerDBID(int id)
Constructor from integer id.
|
protected |
IntegerDBID(Integer id)
Constructor from integer id.
|
| Modifier and Type | Method and Description |
|---|---|
void |
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.
|
int |
compareTo(DBIDRef o)
Compare two DBIDs for ordering.
|
boolean |
contains(DBIDRef o)
Test whether an ID is contained.
|
boolean |
equals(Object obj)
Deprecated.
|
DBID |
get(int i)
Get the i'th entry (starting at 0)
If possible, use an
DBIDArrayIter via ArrayDBIDs.iter() instead! |
int |
hashCode()
In contrast to
DBIDRef, the DBID interface is supposed to have a
stable hash code. |
int |
internalGetIndex()
Return the integer value of the object ID.
|
boolean |
isEmpty()
Test for an empty DBID collection.
|
IntegerDBID.Itr |
iter()
Iterable
|
int |
size()
Size of the DBID "collection".
|
ArrayDBIDs |
slice(int begin,
int end)
Slice a subarray (as view, not copy!)
|
String |
toString() |
protected final int id
public static final ByteBufferSerializer<DBID> DYNAMIC_SERIALIZER
public static final FixedSizeByteBufferSerializer<DBID> STATIC_SERIALIZER
protected IntegerDBID(int id)
id - integer id.protected IntegerDBID(Integer id)
id - integer id.public int internalGetIndex()
internalGetIndex in interface DBIDRefinternalGetIndex in interface IntegerDBIDRefpublic int size()
ArrayDBIDssize in interface ArrayDBIDssize in interface DBIDspublic boolean isEmpty()
DBIDspublic int hashCode()
DBIDDBIDRef, the DBID interface is supposed to have a
stable hash code. However, it is generally preferred to use optimized
storage classes instead of Java collections!@Deprecated public boolean equals(Object obj)
DBIDDBIDRef, the DBID interface is supposed to have a
stable equals for other DBIDs.
Yet, DBIDUtil.equal(de.lmu.ifi.dbs.elki.database.ids.DBIDRef, de.lmu.ifi.dbs.elki.database.ids.DBIDRef) is more type safe and explicit.public int compareTo(DBIDRef o)
DBIDDBIDUtil.compare(de.lmu.ifi.dbs.elki.database.ids.DBIDRef, de.lmu.ifi.dbs.elki.database.ids.DBIDRef), which is more explicit.compareTo in interface DBIDcompareTo in interface Comparable<DBIDRef>o - Other DBID objectpublic IntegerDBID.Itr iter()
ArrayDBIDsiter in interface ArrayDBIDsiter in interface DBIDspublic DBID get(int i)
ArrayDBIDsDBIDArrayIter via ArrayDBIDs.iter() instead!get in interface ArrayDBIDsi - Indexpublic void assignVar(int index,
DBIDVar var)
ArrayDBIDsindex.assignVar in interface ArrayDBIDsindex - Positionvar - Variable to assign the value to.public boolean contains(DBIDRef o)
DBIDspublic int binarySearch(DBIDRef key)
ArrayDBIDs-(1+insertion position) is returned, as
for Java Collections.binarySearch(java.util.List<? extends java.lang.Comparable<? super T>>, T)binarySearch in interface ArrayDBIDskey - Key to search forpublic ArrayDBIDs slice(int begin, int end)
ArrayDBIDsslice in interface ArrayDBIDsbegin - Begin (inclusive)end - End (exclusive)