classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cp-patches]: FYI: GapContent fix


From: Roman Kennke
Subject: Re: [cp-patches]: FYI: GapContent fix
Date: Wed, 07 Sep 2005 21:40:18 +0200

> > Lillian> -      if (mark <= gapStart)
> > Lillian> +      if (mark <= gapStart || mark <= gapEnd)
> > 
> > Isn't gapEnd >= gapStart?
> > So the first test is redundant?

Sorry, I think the first version (mark <= gapStart) is correct as it
was. The mark should always be 0<=mark<gapStart || gapEnd <= mark <=
buffer.length. If it isn't then there is a problem at another place
(very likely in shiftGap or shiftEnd, where the marks are updated). This
is a typical case where I think an assert statement makes sense, that is
to check the precondition. Also this is a case where we seriously need a
Mauve test to check for regressions.

> > Also, in passing, I wonder whether GapContent should use an ArrayList
> > rather than a LinkedList to store the list of positions, for
> > efficiency.

Yeah, this is very well possible. I have not thought about this deep
enough when writing this code.

/Roman

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]