From: Conal T. <con...@vu...> - 2008-03-11 04:16:03
|
On Tue, 2008-03-11 at 16:39 +1300, Xuân Baldauf wrote: > If I remember correctly, I think > http://tm4j.cvs.sourceforge.net/tm4j/tm4j/src/org/tm4j/topicmap/tmdm/tm4j1/TopicMapObjectImpl.java?revision=1.5&view=markup#l_126 is the reason for equalsByID(). This provider is a bridge between XML Topic Maps (in the style of TM4J 0.9.x) and TMDM (in the style of TM4J2). TMDM in general, and the TM4J2-implementation of TMDM in particular, does not require a TopicMapObject to have exactly one ID. Consequently, getID() is not defined, strictly speaking. If getID() is called anyways, some compatibility magic auto-creates an ID if no ID cannot be found or somehow inferred. However, this is a kludge (as a read-only method has a state-changing behaviour), and should be avoided, especially if the only purpose of calling getID() is comparing whether two TopicMapObjects are equal in some sense (which should be read-only-process in turn). You do not want to have an OutOfMemoryError just because you called getID(). Why not just use the equals() method then, Xuan? Isn't that the purpose of equalsByID()? Or is there some difference in semantics between equals() and equalsByID()? -- Conal Tuohy New Zealand Electronic Text Centre www.nzetc.org |