de.lmu.ifi.dbs.elki.database.ids.integer
Class IntegerDBID

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<DBID>
          extended by de.lmu.ifi.dbs.elki.database.ids.integer.IntegerDBID
All Implemented Interfaces:
ArrayDBIDs, ArrayStaticDBIDs, DBID, DBIDs, StaticDBIDs, Comparable<DBID>, Iterable<DBID>, Collection<DBID>, List<DBID>

 class IntegerDBID
extends AbstractList<DBID>
implements DBID

Database ID object. While this currently is just an Integer, it should be avoided to store the object IDs in regular integers to reduce problems if this API ever changes (for example if someone needs to support 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.


Nested Class Summary
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.
 
Field Summary
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.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
protected IntegerDBID(int id)
          Constructor from integer id.
protected IntegerDBID(Integer id)
          Constructor from integer id.
 
Method Summary
 Collection<DBID> asCollection()
          Retrieve collection access to the IDs
 int compareTo(DBID o)
           
 boolean contains(Object o)
          Test whether an ID is contained.
 boolean equals(Object obj)
           
 DBID get(int i)
           
 int getIntegerID()
          Return the integer value of the object ID.
 int hashCode()
           
 boolean isEmpty()
          Test for an empty DBID collection.
 Iterator<DBID> iterator()
          Retrieve Iterator access to the IDs.
 int size()
          Retrieve the collection / data size.
 String toString()
           
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, indexOf, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, containsAll, indexOf, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray
 

Field Detail

id

protected final int id
The actual object ID.


dynamicSerializer

public static final IntegerDBID.DynamicSerializer dynamicSerializer
The public instance to use for dynamic serialization.


staticSerializer

public static final IntegerDBID.StaticSerializer staticSerializer
The public instance to use for static serialization.

Constructor Detail

IntegerDBID

protected IntegerDBID(int id)
Constructor from integer id.

Parameters:
id - integer id.

IntegerDBID

protected IntegerDBID(Integer id)
Constructor from integer id.

Parameters:
id - integer id.
Method Detail

getIntegerID

public int getIntegerID()
Return the integer value of the object ID.

Specified by:
getIntegerID in interface DBID
Returns:
integer id

toString

public String toString()
Overrides:
toString in class AbstractCollection<DBID>

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<DBID>
Specified by:
hashCode in interface List<DBID>
Overrides:
hashCode in class AbstractList<DBID>

equals

public boolean equals(Object obj)
Specified by:
equals in interface Collection<DBID>
Specified by:
equals in interface List<DBID>
Overrides:
equals in class AbstractList<DBID>

compareTo

public int compareTo(DBID o)
Specified by:
compareTo in interface Comparable<DBID>

asCollection

public Collection<DBID> asCollection()
Description copied from interface: DBIDs
Retrieve collection access to the IDs

Specified by:
asCollection in interface DBIDs
Returns:
a collection of IDs

contains

public boolean contains(Object o)
Description copied from interface: DBIDs
Test whether an ID is contained. Signature compatible with Collection.

Specified by:
contains in interface DBIDs
Specified by:
contains in interface Collection<DBID>
Specified by:
contains in interface List<DBID>
Overrides:
contains in class AbstractCollection<DBID>
Parameters:
o - object to test
Returns:
true when contained

iterator

public Iterator<DBID> iterator()
Description copied from interface: DBIDs
Retrieve Iterator access to the IDs.

Specified by:
iterator in interface DBIDs
Specified by:
iterator in interface Iterable<DBID>
Specified by:
iterator in interface Collection<DBID>
Specified by:
iterator in interface List<DBID>
Overrides:
iterator in class AbstractList<DBID>
Returns:
an iterator for the IDs

size

public int size()
Description copied from interface: DBIDs
Retrieve the collection / data size.

Specified by:
size in interface DBIDs
Specified by:
size in interface Collection<DBID>
Specified by:
size in interface List<DBID>
Specified by:
size in class AbstractCollection<DBID>
Returns:
collection size

isEmpty

public boolean isEmpty()
Description copied from interface: DBIDs
Test for an empty DBID collection.

Specified by:
isEmpty in interface DBIDs
Specified by:
isEmpty in interface Collection<DBID>
Specified by:
isEmpty in interface List<DBID>
Overrides:
isEmpty in class AbstractCollection<DBID>
Returns:
true when empty.

get

public DBID get(int i)
Specified by:
get in interface List<DBID>
Specified by:
get in class AbstractList<DBID>

Release 0.4.0 (2011-09-20_1324)