org.apache.woden.ant
Class ObjectIdTable

java.lang.Object
  extended by org.apache.woden.ant.ObjectIdTable

public class ObjectIdTable
extends java.lang.Object

Provides a completely safe way to generate unique ids for equivalence classes of objects. Equivalent objects are assigned the same ids. Inequivalent objects are assigned different ids. Here equivalance is defined by the equals() method which is used by HashMap. Experience has shown that hashCode() occasionally produces the same hash for different objects. Note that the objects are permanently stored, so only use this class when serializing objects in an XML file. A count is kept and assigned to each object equivalence class as it is added.

Author:
Arthur Ryman (ryman@ca.ibm.com, arthur.ryman@gmail.com)

Constructor Summary
ObjectIdTable()
           
 
Method Summary
 int id(java.lang.Object o)
          Returns a unique integer for the equivalence class of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectIdTable

public ObjectIdTable()
Method Detail

id

public int id(java.lang.Object o)
Returns a unique integer for the equivalence class of the object.

Parameters:
o - An object.
Returns:
A unique id for the object.


Copyright © 2007. All Rights Reserved.