Skip to content

Commit 62bdc46

Browse files
committed
do not wait for unihan
1 parent fcb0a1c commit 62bdc46

File tree

3 files changed

+36
-28
lines changed

3 files changed

+36
-28
lines changed

UnicodeJsps/src/main/java/org/unicode/jsp/UcdLoader.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ private static void loadUcdHistory(VersionInfo earliest, boolean includeUnihan)
4949
var version = VersionInfo.getInstance(age.getShortName());
5050
final long ucdStart = System.currentTimeMillis();
5151
System.out.println("Loading UCD " + age.getShortName() + "...");
52-
for (boolean unihan : includeUnihan ? new boolean[] {false, true} : new boolean[] {false}) {
52+
for (boolean unihan :
53+
includeUnihan ? new boolean[] {false, true} : new boolean[] {false}) {
5354
final long partStart = System.currentTimeMillis();
5455
final String name = unihan ? "Unihan" : "non-Unihan properties";
5556
final var properties = IndexUnicodeProperties.make(age.getShortName());

UnicodeJsps/src/main/java/org/unicode/jsp/UnicodeUtilities.java

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1409,8 +1409,11 @@ public static void showProperties(
14091409
TreeSet<String> sortedProps =
14101410
Builder.with(new TreeSet<String>(col)).addAll(availableNames).remove("Name").get();
14111411

1412-
String kRSUnicode = getFactory().getProperty("kRSUnicode").getValue(cp);
1413-
boolean isUnihan = kRSUnicode != null;
1412+
boolean isUnihan =
1413+
getFactory()
1414+
.getProperty("Udev:Block")
1415+
.getValue(cp)
1416+
.matches("CJK.(Unified|Compatibility).Ideographs");
14141417

14151418
Age_Values age = Age_Values.forName(getFactory().getProperty("Age").getValue(cp));
14161419
VersionInfo minVersion =
@@ -1424,7 +1427,7 @@ public static void showProperties(
14241427
out.append(
14251428
"<p class='changed'>Still loading UCD versions before "
14261429
+ minVersion.getVersionString(2, 4)
1427-
+ "</p>");
1430+
+ "</p>");
14281431
}
14291432

14301433
out.append(
@@ -1472,25 +1475,34 @@ public static void showProperties(
14721475

14731476
out.append("</td></tr></table>\n");
14741477
if (isUnihan) {
1475-
out.append(
1476-
"<table class='propTable'>"
1477-
+ "<caption>"
1478-
+ "Unihan properties for U+"
1479-
+ hex
1480-
+ "</caption>"
1481-
+ "<tr><td width='50%'>\n");
1482-
out.append("<table width='100%'>\n");
1483-
for (int i = 0; i < unihanProperties.size() / 2; ++i) {
1484-
showPropertyValue(unihanProperties.get(i), cp, minVersion, maxVersion, false, out);
1485-
}
1486-
out.append("</table>\n");
1487-
out.append("</td><td width='50%'>\n");
1488-
out.append("<table width='100%'>\n");
1489-
for (int i = unihanProperties.size() / 2; i < unihanProperties.size(); ++i) {
1490-
showPropertyValue(unihanProperties.get(i), cp, minVersion, maxVersion, false, out);
1491-
}
1492-
out.append("</table>\n");
1493-
out.append("</td></tr></table>\n");
1478+
if (UcdLoader.getOldestLoadedUnihan() == minVersion) {
1479+
out.append(
1480+
"<table class='propTable'>"
1481+
+ "<caption>"
1482+
+ "Unihan properties for U+"
1483+
+ hex
1484+
+ "</caption>"
1485+
+ "<tr><td width='50%'>\n");
1486+
out.append("<table width='100%'>\n");
1487+
for (int i = 0; i < unihanProperties.size() / 2; ++i) {
1488+
showPropertyValue(
1489+
unihanProperties.get(i), cp, minVersion, maxVersion, false, out);
1490+
}
1491+
out.append("</table>\n");
1492+
out.append("</td><td width='50%'>\n");
1493+
out.append("<table width='100%'>\n");
1494+
for (int i = unihanProperties.size() / 2; i < unihanProperties.size(); ++i) {
1495+
showPropertyValue(
1496+
unihanProperties.get(i), cp, minVersion, maxVersion, false, out);
1497+
}
1498+
out.append("</table>\n");
1499+
out.append("</td></tr></table>\n");
1500+
} else {
1501+
out.append(
1502+
"<p class='changed'>Still loading Unihan "
1503+
+ minVersion.getVersionString(2, 4)
1504+
+ "…</p>");
1505+
}
14941506
}
14951507
}
14961508

UnicodeJsps/src/test/java/org/unicode/jsptest/TestUnicodeSet.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,13 @@
44
import static org.junit.jupiter.api.Assumptions.assumeTrue;
55
import static org.junit.jupiter.params.provider.Arguments.arguments;
66

7-
import com.google.common.base.Objects;
87
import com.ibm.icu.impl.Row.R2;
9-
import com.ibm.icu.impl.Utility;
108
import com.ibm.icu.lang.UCharacter;
119
import com.ibm.icu.lang.UProperty;
1210
import com.ibm.icu.lang.UProperty.NameChoice;
13-
import com.ibm.icu.text.BreakIterator;
14-
import com.ibm.icu.text.UTF16;
1511
import com.ibm.icu.text.UnicodeSet;
1612
import com.ibm.icu.util.LocaleData;
1713
import com.ibm.icu.util.TimeZone;
18-
import com.ibm.icu.util.ULocale;
1914
import com.ibm.icu.util.VersionInfo;
2015
import java.io.IOException;
2116
import java.nio.charset.Charset;

0 commit comments

Comments
 (0)