DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=27901>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=27901

[PATCH] TextCharIterator.remove() does not work properly





------- Additional Comments From [EMAIL PROTECTED]  2004-04-04 06:41 -------
The BlackList method is not my favorite, because I suspect only a few percent of
extra spaces found are between words--the extra complexity appears unwarranted.
 My debugging has indicated that 95%+ of extra spaces all appear at the
beginning of the FOText object, so it is best to just increment a start index
for those.  For the few percent of errant extra spaces between words, then an
arraycopy can be called, removing the spaces one-by-one.  (Keep in mind, one
month ago we were doing an arraycopy for *every* space, even those at the
beginning of the string, so a 95% reduction in arraycopies is already a huge
improvement.)  Please advise if you've come to different conclusions--but the
complexity doesn't appear necessary to me.  HOWEVER/Note:  I've only been
working with fo:blocks, not with fo:inlines, so my above reasoning may not be
valid when those are taken into consideration.

Anyway, please check the latest solution applied.  Here I brought in the old
solution to solve the extra spaces problem, while keeping the new solution for
the more commonly occurring spaces at the front of fo:text.

The (commented-out) System.out.println's in the remove() method are useful for
visualizing the space removal, and indicate the following:

RemoveA:  Newest method, that just increments the start index until a
word is found.  No array copies needed here, very speedy.

RemoveB and RemoveC:  The previous method, ideally just activated for the
relatively rare occurrences of extra spaces between words.  Unfortunately,
RemoveB and RemoveC are called much more often (50% or so) than they should be 
(As stated above, I suspect < 10%), so more optimization may be needed here. 
(Perhaps an error in my logic of when RemoveA vs. RemoveB should be called.)

Comments most welcome.

Glen

Reply via email to