Name: bb33257 Date: 07/29/97
BreakIterator should probably have a preceding() method as a
counterpart to its following() method. An optimized algorithm
for line breaking would estimate the number of characters in a
line, set the iterator to point to the last break position before
that point, and move forward from there. Right now, you have to
do that by calling following() and then calling previous(). This
has a fairly significant performance cose: following() starts at
the specified position, rewinds to the first safe position it can
iterate forward from (which is _a_ break position before the
specified position, but not necessarily the _last_ one), and
iterates forward until it reaches the first break position after
the specified position. If I then call previous(), I then rewind
back to a position I've already passed, possibly overshooting it
again. A preceding() call could eliminate much of the extra
seeking BreakIterator has to do in this case.
======================================================================
- duplicates
-
JDK-4052418 API: Add TextBoundary.isBoundary(offset) and preceeding(offset)
-
- Closed
-