org.apache.woden.ant
Class ObjectIdTable
java.lang.Object
org.apache.woden.ant.ObjectIdTable
public class ObjectIdTable
- extends 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)
Method Summary |
int |
id(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 |
ObjectIdTable
public ObjectIdTable()
id
public int id(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 © 2005-2011 Apache Software Foundation. All Rights Reserved.