Just 2 comments:
 - I understand the use of the sentinel but in the very fast glance I
   took at the code I still did not understand a couple of bits of 
   code related to it. Since it was a very fast glance, it is very 
   probable that everything is ok and that I just didn't get it yet.

 - I should have been more explicit about "code style". I mean "code
   formatting style". This is an ongoing discussion and I am not sure
   that the "right way" is well defined at the commons. 

Hey everybody!
Is there a well defined rule for Code Formatting Style at the Commons?

The Jakarta general rule at:
  http://jakarta.apache.org/site/source.html

is:
  All Java Language source code in the repository must be written in 
  conformance to the "Code Conventions for the Java Programming
  Language as published by Sun, or in conformance with another 
  well-defined convention specified by the subproject. See the FAQ 
  page for links to subproject conventions. 

Some projects like Velocity:
  http://jakarta.apache.org/velocity/code-standards.html
define such non-Sun conventions.


The Commons should either define their own rules or (argh!) follow
the Sun guidelines.


Have fun,
Paulo Gaspar



> -----Original Message-----
> From: Michael Smith [mailto:[EMAIL PROTECTED]]
> Sent: Friday, February 01, 2002 3:25 PM
> To: Jakarta Commons Developers List
> Subject: RE: [collections][PATCH] SequencedHashMap violates Map
> contract, has poor performance
> 
> 
> > -----Original Message-----
> >
> > I just took a look at the code.
> >
> > There were a couple of details that are still not clear to me (as
> > around the "sentinel" use) but it looks much better than what we have
> > and it is e very complete implementation of the Map interface.
> 
> The sentinel style linked list is based on the algorithm described in
> "Introduction to Algorithms" by Cormen Leiserson and Rivest, a book that
> I highly recommend.  It allows you to pretty much ignore the boundary
> conditions.
> 
> There are references to using sentinels on the web as well:
> http://www.cs.utk.edu/~plank/plank/classes/cs360/360/notes/Dllists/
> http://www.cs.utk.edu/~plank/plank/classes/cs360/360/notes/Dlists/lectur
> e.html
> http://www.cs.sunysb.edu/~algorith/lectures-good/node7.html
> http://dept-info.labri.u-bordeaux.fr/~strandh/Teaching/MTP/Common/Strand
> h-Tutorial/sentinel.html
> 
> > However (playing Jon) there is a code style issue there.
> 
> In using a sentinel?  I can update the code to describe the algorithm
> used.  I'll do that as soon as I have time -- either this evening or
> tomorrow.
> 
> > Michael, you sure save on lines of code but is is not so easy to read
> > that way.
> 
> If you're still referring to the sentinel thing, it's not about lines of
> code.  It's about efficiency of the algorithm.
> 
> Compare:
> 
> void remove(Entry e) {
>   if(e == head) {
>       // entry is at head of list, update head rather than previous's
> next
>       head = e.next;
>   } else {
>       e.prev.next = e.next;
>   }
>   if(e == tail) {
>       // entry is at tail of list, update tail rather than next's
> previous
>       tail = e.prev;
>   } else {
>       e.next.prev = e.prev;
>   }
> }
> 
> To:
> 
> void remove(Entry e) {
>   e.next.prev = e.prev
>   e.prev.next = e.next
> }
> 
> 
> > Have fun,
> 
> always!
> 
> > Paulo Gaspar
> 
> regards,
> michael
> 
> >
> > > -----Original Message-----
> > > From: James Strachan [mailto:[EMAIL PROTECTED]]
> > > Sent: Friday, February 01, 2002 2:01 PM
> > > To: Jakarta Commons Developers List
> > > Subject: Re: [collections][PATCH] SequencedHashMap violates Map
> > > contract, has poor performance
> > >
> > >
> > > +1
> > >
> > > Sounds good to me.
> > >
> > > James
> > > ----- Original Message -----
> > > From: "Remy Maucherat" <[EMAIL PROTECTED]>
> > > > > I've submitted this patch twice now (once back in
> > mid-November, once a
> > > > > week ago), but it still has yet to be committed.
> > > >
> > > > If nobody has time to apply or look at Michael's patches, how
> > > about giving
> > > > him karma on jakarta-commons ?
> > > >
> > > > Remy
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > > For additional commands, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > >
> > >
> > > _________________________________________________________
> > > Do You Yahoo!?
> > > Get your free @yahoo.com address at http://mail.yahoo.com
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> > <mailto:[EMAIL PROTECTED]>
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> 
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: 
> <mailto:[EMAIL PROTECTED]>
> 

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

Reply via email to