< prev index next >
src/java.base/share/classes/java/text/RBTableBuilder.java
Print this page
rev 51919 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: dfuchs, alanb
*** 73,89 ****
* ONLY by the RBCollationTables constructor.
* @see RuleBasedCollator#RuleBasedCollator
* @exception ParseException If the rules format is incorrect.
*/
! public void build(String pattern, int decmp) throws ParseException
! {
! boolean isSource = true;
! int i = 0;
String expChars;
String groupChars;
! if (pattern.length() == 0)
throw new ParseException("Build rules empty.", 0);
// This array maps Unicode characters to their collation ordering
mapping = new UCompactIntArray(RBCollationTables.UNMAPPED);
// Normalize the build rules. Find occurances of all decomposed characters
--- 73,86 ----
* ONLY by the RBCollationTables constructor.
* @see RuleBasedCollator#RuleBasedCollator
* @exception ParseException If the rules format is incorrect.
*/
! public void build(String pattern, int decmp) throws ParseException {
String expChars;
String groupChars;
! if (pattern.isEmpty())
throw new ParseException("Build rules empty.", 0);
// This array maps Unicode characters to their collation ordering
mapping = new UCompactIntArray(RBCollationTables.UNMAPPED);
// Normalize the build rules. Find occurances of all decomposed characters
*** 117,128 ****
mPattern = new MergeCollation(pattern);
int order = 0;
// Now walk though each entry and add it to my own tables
! for (i = 0; i < mPattern.getCount(); ++i)
! {
PatternEntry entry = mPattern.getItemAt(i);
if (entry != null) {
groupChars = entry.getChars();
if (groupChars.length() > 1) {
switch(groupChars.charAt(groupChars.length()-1)) {
--- 114,124 ----
mPattern = new MergeCollation(pattern);
int order = 0;
// Now walk though each entry and add it to my own tables
! for (int i = 0; i < mPattern.getCount(); ++i) {
PatternEntry entry = mPattern.getItemAt(i);
if (entry != null) {
groupChars = entry.getChars();
if (groupChars.length() > 1) {
switch(groupChars.charAt(groupChars.length()-1)) {
*** 138,148 ****
}
order = increment(entry.getStrength(), order);
expChars = entry.getExtension();
! if (expChars.length() != 0) {
addExpandOrder(groupChars, expChars, order);
} else if (groupChars.length() > 1) {
char ch = groupChars.charAt(0);
if (Character.isHighSurrogate(ch) && groupChars.length() == 2) {
addOrder(Character.toCodePoint(ch, groupChars.charAt(1)), order);
--- 134,144 ----
}
order = increment(entry.getStrength(), order);
expChars = entry.getExtension();
! if (!expChars.isEmpty()) {
addExpandOrder(groupChars, expChars, order);
} else if (groupChars.length() > 1) {
char ch = groupChars.charAt(0);
if (Character.isHighSurrogate(ch) && groupChars.length() == 2) {
addOrder(Character.toCodePoint(ch, groupChars.charAt(1)), order);
< prev index next >