Skip to content

Commit 84a9500

Browse files
authored
Update UnicodeJsps to U13.0 and E13.1 (#44)
1 parent fdc77be commit 84a9500

22 files changed

+45118
-46
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ public static String getIdentifier(String script) {
350350

351351
static final String VERSIONS = "Version 3.9; "
352352
+ "ICU version: " + VersionInfo.ICU_VERSION.getVersionString(2, 2) + "; "
353-
+ "Unicode version: " + UCharacter.getUnicodeVersion().getVersionString(2, 2) + "; "
353+
+ "Unicode/Emoji version: " + UCharacter.getUnicodeVersion().getVersionString(2, 2) + "; "
354354
+ (CachedProps.IS_BETA ? "Unicodeβ version: " + CachedProps.CACHED_PROPS.version.getVersionString(2, 2) + "; " : "");
355355

356356
public static String getVersions() {

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

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public abstract class UnicodeProperty extends UnicodeLabel {
6969
.add(SAMPLE_PRIVATE_USE_AREA_A)
7070
.add(SAMPLE_PRIVATE_USE_AREA_B)
7171
.freeze();
72-
72+
7373
public static final UnicodeSet STUFF_TO_TEST_WITH_UNASSIGNED = new UnicodeSet(STUFF_TO_TEST).addAll(UNASSIGNED).freeze();
7474

7575
public static boolean DEBUG = false;
@@ -90,7 +90,7 @@ public abstract class UnicodeProperty extends UnicodeLabel {
9090

9191
/*
9292
* Name: Unicode_1_Name Name: ISO_Comment Name: Name Name: Unicode_1_Name
93-
*
93+
*
9494
*/
9595

9696
public static final int UNKNOWN = 0, BINARY = 2, EXTENDED_BINARY = 3,
@@ -269,6 +269,14 @@ public int getMaxWidth(boolean getShortest) {
269269
return maxValueWidth;
270270
}
271271

272+
public final UnicodeSet getTrueSet() {
273+
if (!isType(BINARY)) {
274+
throw new IllegalArgumentException("Only applicable to binary (boolean) properties, not " + getName() +
275+
" which is of type " + getTypeName());
276+
}
277+
return getSet("Yes", null);
278+
}
279+
272280
public final UnicodeSet getSet(String propertyValue) {
273281
return getSet(propertyValue, null);
274282
}
@@ -324,7 +332,7 @@ public UnicodeSet getSet(PatternMatcher matcher, UnicodeSet result) {
324332
/*
325333
* public UnicodeSet getMatchSet(UnicodeSet result) { if (result == null)
326334
* result = new UnicodeSet(); addAll(matchIterator, result); return result; }
327-
*
335+
*
328336
* public void setMatchSet(UnicodeSet set) { matchIterator = new
329337
* UnicodeSetIterator(set); }
330338
*/
@@ -453,7 +461,7 @@ protected UnicodeMap _getUnicodeMap() {
453461
}
454462

455463
UnicodeSet sameValueRanges = null;
456-
464+
457465
private UnicodeSet getSameValueRanges(boolean uniformUnassigned) {
458466
if (sameValueRanges == null) {
459467
sameValueRanges = new UnicodeSet();
@@ -508,7 +516,7 @@ public int compare(Object o1, Object o2) {
508516

509517
/**
510518
* Utility for managing property & non-string value aliases
511-
*
519+
*
512520
*/
513521
// TODO optimize
514522
public static boolean equalNames(String a, String b) {
@@ -642,7 +650,7 @@ public static String regularize(String source, boolean titlecaseStart) {
642650
/**
643651
* Utility function for comparing codepoint to string without generating new
644652
* string.
645-
*
653+
*
646654
* @param codepoint
647655
* @param other
648656
* @return true if the codepoint equals the string
@@ -670,7 +678,7 @@ public static final <T extends Object> boolean equals(T a, T b) {
670678

671679
/**
672680
* Utility that should be on UnicodeSet
673-
*
681+
*
674682
* @param source
675683
* @param result
676684
*/
@@ -1140,7 +1148,7 @@ public static abstract class BaseProperty extends UnicodeProperty {
11401148
private static final String[] YES_VALUES = {"Yes", "Y", "T", "True"};
11411149

11421150
/**
1143-
*
1151+
*
11441152
*/
11451153
private static final String[][] YES_NO_ALIASES = new String[][] {YES_VALUES, NO_VALUES};
11461154

@@ -1344,7 +1352,7 @@ public UnicodeMapProperty set(UnicodeMap map) {
13441352
unicodeMap = map.freeze();
13451353
return this;
13461354
}
1347-
1355+
13481356
@Override
13491357
protected UnicodeMap _getUnicodeMap() {
13501358
return unicodeMap;
@@ -1400,7 +1408,7 @@ public static UnicodeSet addUntested(UnicodeSet result, boolean uniformUnassigne
14001408
if (uniformUnassigned && result.contains(UnicodeProperty.SAMPLE_UNASSIGNED)) {
14011409
result.addAll(UnicodeProperty.UNASSIGNED);
14021410
}
1403-
1411+
14041412
if (result.contains(UnicodeProperty.SAMPLE_HIGH_SURROGATE)) {
14051413
result.addAll(UnicodeProperty.HIGH_SURROGATES);
14061414
}
@@ -1410,7 +1418,7 @@ public static UnicodeSet addUntested(UnicodeSet result, boolean uniformUnassigne
14101418
if (result.contains(UnicodeProperty.SAMPLE_LOW_SURROGATE)) {
14111419
result.addAll(UnicodeProperty.LOW_SURROGATES);
14121420
}
1413-
1421+
14141422
if (result.contains(UnicodeProperty.SAMPLE_PRIVATE_USE_AREA)) {
14151423
result.addAll(UnicodeProperty.PRIVATE_USE_AREA);
14161424
}
@@ -1458,7 +1466,7 @@ public boolean isDefault(int cp) {
14581466
return equals(cp, value);
14591467
}
14601468
String defaultValue = getValue(SAMPLE_UNASSIGNED);
1461-
return defaultValue == null ? value == null : defaultValue.equals(value);
1469+
return defaultValue == null ? value == null : defaultValue.equals(value);
14621470
}
14631471

14641472
public boolean hasUniformUnassigned() {

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -350,13 +350,7 @@ public static void showSet(UnicodeSet inputSetRaw, CodePointShower codePointShow
350350
out.append("</td></tr>");
351351
}
352352
} else if (codePointShower.abbreviate) {
353-
if (codePointShower.doTable) {
354-
out.append("<tr><td colSpan='4'>");
355-
}
356353
codePointShower.showAbbreviated(inputSetRaw, out);
357-
if (codePointShower.doTable) {
358-
out.append("</td></tr>");
359-
}
360354
} else {
361355
LinkedHashMap<String,UnicodeSet> items = new LinkedHashMap<String, UnicodeSet>();
362356
String specials = "Unassigned, Private use, or Surrogates";
@@ -392,7 +386,7 @@ public static void showSet(UnicodeSet inputSetRaw, CodePointShower codePointShow
392386
for (String newBlock : items.keySet()) {
393387
UnicodeSet set = items.get(newBlock);
394388
if (codePointShower.doTable) {
395-
out.append("<tr><td colSpan='4'>");
389+
out.append("<tr><td colSpan='3'>");
396390
}
397391
out.append("<h3>" + newBlock + "</b> <div class='ri'>items: " + numberFormat.format(set.size()) + "</div></h3>\n");
398392
if (codePointShower.doTable) {
@@ -627,10 +621,15 @@ List<UnicodeProperty> getProps(String input) {
627621
private void showAbbreviated(UnicodeSet a, Appendable out) throws IOException {
628622
UnicodeUtilities.CodePointShower codePointShower = this;
629623

624+
boolean haveStrings = false;
630625
for (UnicodeSetIterator it = new UnicodeSetIterator(a); it.nextRange();) {
631626
int s = it.codepoint;
632627
if (s == UnicodeSetIterator.IS_STRING) {
633-
out.append(UnicodeUtilities.showCodePoint(it.string)).append("<br>\n");
628+
if (!haveStrings && codePointShower.doTable) {
629+
out.append("<tr><td colSpan='3'>");
630+
haveStrings = true;
631+
}
632+
out.append(UnicodeUtilities.showCodePoint(it.string)).append("\n");
634633
} else {
635634
int end = it.codepointEnd;
636635
if (end == s) {
@@ -655,6 +654,9 @@ private void showAbbreviated(UnicodeSet a, Appendable out) throws IOException {
655654
}
656655
}
657656
}
657+
if (haveStrings && codePointShower.doTable) {
658+
out.append("</td></tr>");
659+
}
658660
}
659661

660662
String getPropString(List<UnicodeProperty> props, String codePoints, boolean shortName) {

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

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static synchronized XPropertyFactory make() {
3939
singleton = new XPropertyFactory();
4040
return singleton;
4141
}
42-
42+
4343
public final Factory add2(UnicodeProperty sp) {
4444
UnicodeProperty already = getProperty(sp.getName());
4545
if (already== null) {
@@ -49,8 +49,8 @@ public final Factory add2(UnicodeProperty sp) {
4949
return this;
5050
}
5151
}
52-
53-
{
52+
53+
{
5454
ICUPropertyFactory base = ICUPropertyFactory.make();
5555
for (String propertyAlias : (List<String>)base.getInternalAvailablePropertyAliases(new ArrayList())) {
5656
add(base.getProperty(propertyAlias));
@@ -150,23 +150,26 @@ public String transform(Integer source) {
150150
.setMain("Script_Extensions", "scx", UnicodeProperty.ENUMERATED, "1.1")
151151
.addValueAliases(ScriptTester.getScriptSpecialsAlternates(), false)
152152
);
153-
153+
154154
CachedProps cp = CachedProps.CACHED_PROPS;
155155
for (String prop : cp.getAvailable()) {
156156
add2(cp.getProperty(prop));
157157
}
158-
UnicodeSet Basic_Emoji = cp.getProperty("Basic_Emoji").getSet("Yes");
159-
UnicodeSet RGI_Emoji_Modifier_Sequence = cp.getProperty("RGI_Emoji_Modifier_Sequence").getSet("Yes");
160-
UnicodeSet RGI_Emoji_Tag_Sequence = cp.getProperty("RGI_Emoji_Tag_Sequence").getSet("Yes");
161-
UnicodeSet RGI_Emoji_Zwj_Sequence = cp.getProperty("RGI_Emoji_Zwj_Sequence").getSet("Yes");
158+
UnicodeSet Basic_Emoji = cp.getProperty("Basic_Emoji").getSet("Yes", null); // TODO: was .getTrueSet();
159+
UnicodeSet Emoji_Keycap_Sequence = cp.getProperty("RGI_Emoji_Keycap_Sequence").getSet("Yes", null); // TODO: was .getTrueSet();
160+
UnicodeSet RGI_Emoji_Modifier_Sequence = cp.getProperty("RGI_Emoji_Modifier_Sequence").getSet("Yes", null); // TODO: was .getTrueSet();
161+
UnicodeSet RGI_Emoji_Tag_Sequence = cp.getProperty("RGI_Emoji_Tag_Sequence").getSet("Yes", null); // TODO: was .getTrueSet();
162+
UnicodeSet RGI_Emoji_Flag_Sequence = cp.getProperty("RGI_Emoji_Flag_Sequence").getSet("Yes", null); // TODO: was .getTrueSet();
163+
UnicodeSet RGI_Emoji_Zwj_Sequence = cp.getProperty("RGI_Emoji_Zwj_Sequence").getSet("Yes", null); // TODO: was .getTrueSet();
162164
UnicodeSet RGI_Emoji = new UnicodeSet()
163165
.add(Basic_Emoji)
166+
.add(Emoji_Keycap_Sequence)
164167
.add(RGI_Emoji_Modifier_Sequence)
168+
.add(RGI_Emoji_Flag_Sequence)
165169
.add(RGI_Emoji_Tag_Sequence)
166170
.add(RGI_Emoji_Zwj_Sequence)
167171
.freeze();
168172
add(new UnicodeSetProperty().set(RGI_Emoji).setMain("RGI_Emoji", "RGI_Emoji", UnicodeProperty.BINARY, "13.0"));
169-
170173
}
171174

172175
private void addCollationProperty() {
@@ -261,7 +264,7 @@ private void addBytes(StringBuilder builder, int bytes) {
261264
builder.append(' ');
262265
}
263266
first = false;
264-
builder.append(hex);
267+
builder.append(hex);
265268
}
266269
}
267270

Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)