class IntegerDBID extends Object implements DBID
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 |
---|---|
protected class |
IntegerDBID.DBIDItr
Pseudo iterator for DBIDs interface.
|
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 IntegerDBID.DynamicSerializer |
dynamicSerializer
The public instance to use for dynamic serialization.
|
protected int |
id
The actual object ID.
|
static IntegerDBID.StaticSerializer |
staticSerializer
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 |
---|---|
int |
binarySearch(DBID key)
Search for the position of the given key, assuming that the data set is
sorted.
|
int |
compareTo(DBID o) |
boolean |
contains(DBID o)
Test whether an ID is contained.
|
boolean |
equals(Object obj) |
DBID |
get(int i)
Get the i'th entry (starting at 0)
|
int |
getIntegerID()
Return the integer value of the object ID.
|
int |
hashCode() |
boolean |
isEmpty()
Test for an empty DBID collection.
|
DBIDIter |
iter()
Iterable
|
Iterator<DBID> |
iterator()
Retrieve Iterator access to the IDs.
|
int |
size()
Size of the DBID "collection".
|
String |
toString() |
protected final int id
public static final IntegerDBID.DynamicSerializer dynamicSerializer
public static final IntegerDBID.StaticSerializer staticSerializer
protected IntegerDBID(int id)
id
- integer id.protected IntegerDBID(Integer id)
id
- integer id.public int getIntegerID()
getIntegerID
in interface DBID
public int compareTo(DBID o)
compareTo
in interface Comparable<DBID>
public DBIDIter iter()
ArrayDBIDs
iter
in interface ArrayDBIDs
iter
in interface DBIDs
public DBID get(int i)
ArrayDBIDs
get
in interface ArrayDBIDs
i
- Indexpublic Iterator<DBID> iterator()
DBIDs
public boolean contains(DBID o)
DBIDs
public int size()
ArrayDBIDs
size
in interface ArrayDBIDs
size
in interface DBIDs
public int binarySearch(DBID 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 ArrayDBIDs
key
- Key to search for