On Thu, 2003-12-04 at 06:16, Ceki GÃlcà wrote:
> At 10:14 AM 12/3/2003 -0800, Scott Deboy wrote:
> >Of course, the contains check always returned false since the receiver
> >reconstructs the loggingevent from the xml representation and
> >LoggingEvent doesn't implement equals.
> >
> >I worked around it by storing a hashset of the event's ID in the model.
> >Duplicates show up if the events were loaded from xml or over the wire
> >from jdk1.4 logging.
> 
> What is the event's ID?
> 

I believe we decided to use an ID as a method of assisting whether
Chainsaw had seen the message before. It's just an incrementing counter.

> What is a *hashset* of the event's ID?

When you try to put an object into a Set (in our case just a Integer),
the Set will return whether it already has that number, and hence we
recognize it as a duplicate.  

This is not the most ideal way of de-duping.  Having an equals and
hashCode method will be perfect.  

One might also consider LoggingEvent implementing the Comparable
interface for , as this is both useful for a natural sort order, and the
TreeSet class uses this interface to keep the items in a red-black tree
for fast searching (it also uses Comparable for deduping).

I've been burnt by  dodgy implementations of each of these methods (all
written by myself, so the blame's all mine), and it is a PITA to track
done. I can help with writing some test cases.

cheers,

Paul





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to