mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-13461 Fixing build error in Java 6.
X-SVN-Rev: 40899
This commit is contained in:
parent
f505457183
commit
0f293044a0
3 changed files with 10 additions and 16 deletions
|
@ -307,14 +307,8 @@ public class NumberParserImpl {
|
|||
/**
|
||||
* Creates a new, empty parser.
|
||||
*
|
||||
* @param ignoreCase
|
||||
* If true, perform case-folding. This parameter needs to go into the constructor because
|
||||
* its value is used during the construction of the matcher chain.
|
||||
* @param optimize
|
||||
* If true, compute "lead chars" UnicodeSets for the matchers. This reduces parsing
|
||||
* runtime but increases construction runtime. If the parser is going to be used only once
|
||||
* or twice, set this to false; if it is going to be used hundreds of times, set it to
|
||||
* true.
|
||||
* @param parseFlags
|
||||
* The parser settings defined in the PARSE_FLAG_* fields.
|
||||
*/
|
||||
public NumberParserImpl(int parseFlags) {
|
||||
matchers = new ArrayList<NumberParseMatcher>();
|
||||
|
|
|
@ -92,13 +92,13 @@ public class StringSegment implements CharSequence {
|
|||
public int getCodePoint() {
|
||||
assert start < end;
|
||||
char lead = str.charAt(start);
|
||||
if (Character.isHighSurrogate(lead) && start + 1 < end) {
|
||||
return Character.toCodePoint(lead, str.charAt(start + 1));
|
||||
} else if (Character.isSurrogate(lead)) {
|
||||
return -1;
|
||||
} else {
|
||||
return lead;
|
||||
char trail;
|
||||
if (Character.isHighSurrogate(lead)
|
||||
&& start + 1 < end
|
||||
&& Character.isLowSurrogate(trail = str.charAt(start + 1))) {
|
||||
return Character.toCodePoint(lead, trail);
|
||||
}
|
||||
return lead;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,10 +56,10 @@ public class StringSegmentTest {
|
|||
StringSegment segment = new StringSegment(SAMPLE_STRING, 0);
|
||||
assertEquals(0x1F4FB, segment.getCodePoint());
|
||||
segment.setLength(1);
|
||||
assertEquals(-1, segment.getCodePoint());
|
||||
assertEquals(0xD83D, segment.getCodePoint());
|
||||
segment.resetLength();
|
||||
segment.adjustOffset(1);
|
||||
assertEquals(-1, segment.getCodePoint());
|
||||
assertEquals(0xDCFB, segment.getCodePoint());
|
||||
segment.adjustOffset(1);
|
||||
assertEquals(0x20, segment.getCodePoint());
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue