-
Type:
Enhancement
-
Resolution: Fixed
-
Priority:
P3
-
Affects Version/s: 1.1.2
-
Component/s: core-libs
-
1.2beta4
-
x86
-
windows_nt
-
Not verified
Name: bb33257 Date: 05/15/97
TextBoundary should have the following methods. The first
is for convenience. The second one allows you to make a
performance speedup when selecting words.
/**
* Check whether current offset is a boundary
* @param offset offset in the text to check.
* @return whether the offset is a boundary.
*/
public boolean isBoundary(int offset)
{
if (offset == 0) return true;
return following(offset-1) == offset;
}
/**
* Return the first boundary before the specified offset
* @param offset the offset to start
* @return int the first boundary before offset
*/
public int preceding(int offset)
{
if (offset < text.getBeginIndex() ||
offset >= text.getEndIndex())
throw new IllegalArgumentException(
"nextBoundaryAt offset out of bounds");
pos = previousSafePosition(offset);
int curr = pos;
int last;
do {
last = curr;
curr = next();
} while (curr < offset && curr != DONE);
return last;
}
======================================================================
- duplicates
-
JDK-4068139 Add preceding() to BreakIterator
-
- Closed
-