Environment for
DeveLoping
KDD-Applications
Supported by Index-Structures

de.lmu.ifi.dbs.elki.utilities.heap
Class DefaultIdentifiable

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.utilities.heap.DefaultIdentifiable
All Implemented Interfaces:
Identifiable, Externalizable, Serializable, Comparable<DefaultIdentifiable>

public class DefaultIdentifiable
extends Object
implements Identifiable, Comparable<DefaultIdentifiable>, Externalizable

Default implementation of the identifiable interface.

Author:
Elke Achtert
See Also:
Serialized Form

Field Summary
private  Integer id
          The unique id of this Identifiable.
private static long serialVersionUID
           
 
Constructor Summary
DefaultIdentifiable()
          Empty constructor for serialization purposes.
DefaultIdentifiable(Integer id)
          Creates a new Identifiable object.
 
Method Summary
 int compareTo(DefaultIdentifiable o)
          Compares this object with the specified object for order.
 boolean equals(Object o)
          Indicates whether some other object is "equal to" this one.
 Integer getID()
          Returns the unique id of this object.
 int hashCode()
          Returns a hash code value for the object.
 void readExternal(ObjectInput in)
          The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays.
 String toString()
          Returns a string representation of the object.
 void writeExternal(ObjectOutput out)
          The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

id

private Integer id
The unique id of this Identifiable.

Constructor Detail

DefaultIdentifiable

public DefaultIdentifiable()
Empty constructor for serialization purposes.


DefaultIdentifiable

public DefaultIdentifiable(Integer id)
Creates a new Identifiable object.

Parameters:
id - the unique id of this Identifiable
Method Detail

getID

public Integer getID()
Returns the unique id of this object.

Specified by:
getID in interface Identifiable
Returns:
the unique id of this object

compareTo

public int compareTo(DefaultIdentifiable o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

Specified by:
compareTo in interface Comparable<DefaultIdentifiable>
Parameters:
o - the Object to be compared.
Returns:
a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.

toString

public String toString()
Returns a string representation of the object.

Overrides:
toString in class Object
Returns:
a string representation of the object.

equals

public boolean equals(Object o)
Indicates whether some other object is "equal to" this one.

Overrides:
equals in class Object
Parameters:
o - the reference object with which to compare.

hashCode

public int hashCode()
Returns a hash code value for the object.

Overrides:
hashCode in class Object
Returns:
a hash code value for the object

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
The object implements the writeExternal method to save its contents by calling the methods of DataOutput for its primitive values or calling the writeObject method of ObjectOutput for objects, strings, and arrays.

Specified by:
writeExternal in interface Externalizable
Parameters:
out - the stream to write the object to
Throws:
IOException - on write errors

readExternal

public void readExternal(ObjectInput in)
                  throws IOException
The object implements the readExternal method to restore its contents by calling the methods of DataInput for primitive types and readObject for objects, strings and arrays. The readExternal method must read the values in the same sequence and with the same types as were written by writeExternal.

Specified by:
readExternal in interface Externalizable
Parameters:
in - the stream to read data from in order to restore the object
Throws:
IOException - on read errors

Release 0.2.1 (2009-07-13_1605)