Skip to content

Commit dbb5dd3

Browse files
committed
Updates from Marcus's review comments
1 parent 6ee2467 commit dbb5dd3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+95
-213
lines changed
Lines changed: 2 additions & 4 deletions

unicodetools/src/main/java/org/unicode/xml/AttributeResolver.java

Lines changed: 3 additions & 125 deletions
Original file line numberDiff line numberDiff line change
@@ -10,46 +10,11 @@ public class AttributeResolver {
1010

1111
private final IndexUnicodeProperties indexUnicodeProperties;
1212
private final UnicodeMap<UcdPropertyValues.Age_Values> map_age;
13-
private final UnicodeMap<UcdPropertyValues.Bidi_Class_Values> map_bidi_class;
14-
private final UnicodeMap<UcdPropertyValues.Bidi_Paired_Bracket_Type_Values>
15-
map_bidi_paired_bracket_type;
1613
private final UnicodeMap<UcdPropertyValues.Block_Values> map_block;
17-
private final UnicodeMap<UcdPropertyValues.Canonical_Combining_Class_Values>
18-
map_canonical_combining_class;
1914
private final UnicodeMap<UcdPropertyValues.Decomposition_Type_Values> map_decomposition_type;
20-
private final UnicodeMap<UcdPropertyValues.Do_Not_Emit_Type_Values> map_do_not_emit_type;
21-
private final UnicodeMap<UcdPropertyValues.East_Asian_Width_Values> map_east_asian_width;
2215
private final UnicodeMap<UcdPropertyValues.General_Category_Values> map_general_category;
23-
private final UnicodeMap<UcdPropertyValues.Grapheme_Cluster_Break_Values>
24-
map_grapheme_cluster_break;
25-
private final UnicodeMap<UcdPropertyValues.Hangul_Syllable_Type_Values>
26-
map_hangul_syllable_type;
27-
private final UnicodeMap<UcdPropertyValues.Identifier_Status_Values> map_identifier_status;
28-
private final UnicodeMap<UcdPropertyValues.Identifier_Type_Values> map_identifier_type;
29-
private final UnicodeMap<UcdPropertyValues.Idn_2008_Values> map_idn_2008;
30-
private final UnicodeMap<UcdPropertyValues.Idn_Status_Values> map_idn_status;
31-
private final UnicodeMap<UcdPropertyValues.Indic_Conjunct_Break_Values>
32-
map_indic_conjunct_break;
33-
private final UnicodeMap<UcdPropertyValues.Indic_Positional_Category_Values>
34-
map_indic_positional_category;
35-
private final UnicodeMap<UcdPropertyValues.Indic_Syllabic_Category_Values>
36-
map_indic_syllabic_category;
37-
private final UnicodeMap<UcdPropertyValues.Jamo_Short_Name_Values> map_jamo_short_name;
38-
private final UnicodeMap<UcdPropertyValues.Joining_Group_Values> map_joining_group;
39-
private final UnicodeMap<UcdPropertyValues.Joining_Type_Values> map_joining_type;
40-
private final UnicodeMap<UcdPropertyValues.Line_Break_Values> map_line_break;
41-
private final UnicodeMap<UcdPropertyValues.NFC_Quick_Check_Values> map_nfc_quick_check;
42-
private final UnicodeMap<UcdPropertyValues.NFD_Quick_Check_Values> map_nfd_quick_check;
43-
private final UnicodeMap<UcdPropertyValues.NFKC_Quick_Check_Values> map_nfkc_quick_check;
44-
private final UnicodeMap<UcdPropertyValues.NFKD_Quick_Check_Values> map_nfkd_quick_check;
45-
private final UnicodeMap<UcdPropertyValues.Numeric_Type_Values> map_numeric_type;
46-
private final UnicodeMap<UcdPropertyValues.Other_Joining_Type_Values> map_other_joining_type;
4716
private final UnicodeMap<UcdPropertyValues.Script_Values> map_script;
4817
private final UnicodeMap<String> map_script_extensions;
49-
private final UnicodeMap<UcdPropertyValues.Sentence_Break_Values> map_sentence_break;
50-
private final UnicodeMap<UcdPropertyValues.Vertical_Orientation_Values>
51-
map_vertical_orientation;
52-
private final UnicodeMap<UcdPropertyValues.Word_Break_Values> map_word_break;
5318
private final HashMap<Integer, LinkedList<NameAlias>> map_NameAlias;
5419

5520
// If there is a change in any of these properties between two adjacent characters, it will
@@ -67,47 +32,12 @@ public class AttributeResolver {
6732
public AttributeResolver(IndexUnicodeProperties iup) {
6833
indexUnicodeProperties = iup;
6934
map_age = indexUnicodeProperties.loadEnum(UcdProperty.Age);
70-
map_bidi_class = indexUnicodeProperties.loadEnum(UcdProperty.Bidi_Class);
71-
map_bidi_paired_bracket_type =
72-
indexUnicodeProperties.loadEnum(UcdProperty.Bidi_Paired_Bracket_Type);
7335
map_block = indexUnicodeProperties.loadEnum(UcdProperty.Block);
74-
map_canonical_combining_class =
75-
indexUnicodeProperties.loadEnum(UcdProperty.Canonical_Combining_Class);
7636
map_decomposition_type = indexUnicodeProperties.loadEnum(UcdProperty.Decomposition_Type);
77-
map_do_not_emit_type = indexUnicodeProperties.loadEnum(UcdProperty.Do_Not_Emit_Type);
78-
map_east_asian_width = indexUnicodeProperties.loadEnum(UcdProperty.East_Asian_Width);
7937
map_general_category = indexUnicodeProperties.loadEnum(UcdProperty.General_Category);
80-
map_grapheme_cluster_break =
81-
indexUnicodeProperties.loadEnum(UcdProperty.Grapheme_Cluster_Break);
82-
map_hangul_syllable_type =
83-
indexUnicodeProperties.loadEnum(UcdProperty.Hangul_Syllable_Type);
84-
map_identifier_status = indexUnicodeProperties.loadEnum(UcdProperty.Identifier_Status);
85-
map_identifier_type = indexUnicodeProperties.loadEnum(UcdProperty.Identifier_Type);
86-
map_idn_2008 = indexUnicodeProperties.loadEnum(UcdProperty.Idn_2008);
87-
map_idn_status = indexUnicodeProperties.loadEnum(UcdProperty.Idn_Status);
88-
map_indic_conjunct_break =
89-
indexUnicodeProperties.loadEnum(UcdProperty.Indic_Conjunct_Break);
90-
map_indic_positional_category =
91-
indexUnicodeProperties.loadEnum(UcdProperty.Indic_Positional_Category);
92-
map_indic_syllabic_category =
93-
indexUnicodeProperties.loadEnum(UcdProperty.Indic_Syllabic_Category);
94-
map_jamo_short_name = indexUnicodeProperties.loadEnum(UcdProperty.Jamo_Short_Name);
95-
map_joining_group = indexUnicodeProperties.loadEnum(UcdProperty.Joining_Group);
96-
map_joining_type = indexUnicodeProperties.loadEnum(UcdProperty.Joining_Type);
97-
map_line_break = indexUnicodeProperties.loadEnum(UcdProperty.Line_Break);
98-
map_nfc_quick_check = indexUnicodeProperties.loadEnum(UcdProperty.NFC_Quick_Check);
99-
map_nfd_quick_check = indexUnicodeProperties.loadEnum(UcdProperty.NFD_Quick_Check);
100-
map_nfkc_quick_check = indexUnicodeProperties.loadEnum(UcdProperty.NFKC_Quick_Check);
101-
map_nfkd_quick_check = indexUnicodeProperties.loadEnum(UcdProperty.NFKD_Quick_Check);
102-
map_numeric_type = indexUnicodeProperties.loadEnum(UcdProperty.Numeric_Type);
103-
map_other_joining_type = indexUnicodeProperties.loadEnum(UcdProperty.Other_Joining_Type);
10438
map_script = indexUnicodeProperties.loadEnum(UcdProperty.Script);
10539
map_script_extensions =
10640
indexUnicodeProperties.getProperty(UcdProperty.Script_Extensions).getUnicodeMap();
107-
map_sentence_break = indexUnicodeProperties.loadEnum(UcdProperty.Sentence_Break);
108-
map_vertical_orientation =
109-
indexUnicodeProperties.loadEnum(UcdProperty.Vertical_Orientation);
110-
map_word_break = indexUnicodeProperties.loadEnum(UcdProperty.Word_Break);
11141

11242
// UCD code is only set up to read a single Alias value from NameAliases.txt
11343
// Instead, we'll load the Alias and the Type data as part of the constructor. We'll keep in
@@ -295,69 +225,17 @@ public String getAttributeValue(UcdProperty prop, int codepoint) {
295225
}
296226
case Enumerated:
297227
switch (prop) {
298-
case Bidi_Class:
299-
return map_bidi_class.get(codepoint).getShortName();
300-
case Bidi_Paired_Bracket_Type:
301-
return map_bidi_paired_bracket_type.get(codepoint).getShortName();
302-
case Canonical_Combining_Class:
303-
return map_canonical_combining_class.get(codepoint).getShortName();
304228
case Decomposition_Type:
305229
// Returning lower case to maintain compatibility with older generated
306230
// files.
307231
return map_decomposition_type
308232
.get(codepoint)
309233
.getShortName()
310234
.toLowerCase(Locale.ROOT);
311-
case Do_Not_Emit_Type:
312-
return map_do_not_emit_type.get(codepoint).getShortName();
313-
case East_Asian_Width:
314-
return map_east_asian_width.get(codepoint).getShortName();
315-
case General_Category:
316-
return map_general_category.get(codepoint).getShortName();
317-
case Grapheme_Cluster_Break:
318-
return map_grapheme_cluster_break.get(codepoint).getShortName();
319-
case Hangul_Syllable_Type:
320-
return map_hangul_syllable_type.get(codepoint).getShortName();
321-
case Identifier_Status:
322-
return map_identifier_status.get(codepoint).getShortName();
323-
case Identifier_Type:
324-
return map_identifier_type.get(codepoint).getShortName();
325-
case Idn_2008:
326-
return map_idn_2008.get(codepoint).getShortName();
327-
case Idn_Status:
328-
return map_idn_status.get(codepoint).getShortName();
329-
case Indic_Conjunct_Break:
330-
return map_indic_conjunct_break.get(codepoint).getShortName();
331-
case Indic_Positional_Category:
332-
return map_indic_positional_category.get(codepoint).getShortName();
333-
case Indic_Syllabic_Category:
334-
return map_indic_syllabic_category.get(codepoint).getShortName();
335-
case Joining_Group:
336-
return map_joining_group.get(codepoint).getShortName();
337-
case Joining_Type:
338-
return map_joining_type.get(codepoint).getShortName();
339-
case Line_Break:
340-
return map_line_break.get(codepoint).getShortName();
341-
case NFC_Quick_Check:
342-
return map_nfc_quick_check.get(codepoint).getShortName();
343-
case NFD_Quick_Check:
344-
return map_nfd_quick_check.get(codepoint).getShortName();
345-
case NFKC_Quick_Check:
346-
return map_nfkc_quick_check.get(codepoint).getShortName();
347-
case NFKD_Quick_Check:
348-
return map_nfkd_quick_check.get(codepoint).getShortName();
349-
case Numeric_Type:
350-
return map_numeric_type.get(codepoint).getShortName();
351-
case Other_Joining_Type:
352-
return map_other_joining_type.get(codepoint).getShortName();
353-
case Sentence_Break:
354-
return map_sentence_break.get(codepoint).getShortName();
355-
case Vertical_Orientation:
356-
return map_vertical_orientation.get(codepoint).getShortName();
357-
case Word_Break:
358-
return map_word_break.get(codepoint).getShortName();
359235
default:
360-
throw new RuntimeException("Missing Enumerated case");
236+
final UnicodeProperty property = indexUnicodeProperties.getProperty(prop);
237+
final List<String> valueAliases = property.getValueAliases(property.getValue(codepoint));
238+
return valueAliases.get(0);
361239
}
362240
case Binary:
363241
{

unicodetools/src/main/java/org/unicode/xml/GeneratePropertyValues.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ private static void createPropertyFragment(
385385
private static void createPropertyFragment(
386386
String filename, String title, SCHEMA schema, String formattedFragment)
387387
throws IOException {
388-
BufferedWriter writer = getFragmentWriter(schema.getName(), filename);
388+
BufferedWriter writer = getFragmentWriter(filename);
389389
writer.write(
390390
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
391391
+ NEWLINE
@@ -403,10 +403,10 @@ private static void createPropertyFragment(
403403
writer.close();
404404
}
405405

406-
private static BufferedWriter getFragmentWriter(String schema, String filename)
406+
private static BufferedWriter getFragmentWriter(String filename)
407407
throws IOException {
408408
File fragmentFolder =
409-
new File(destinationFolder + File.separator + schema + File.separator);
409+
new File(destinationFolder + File.separator);
410410
if (!fragmentFolder.exists()) {
411411
if (!fragmentFolder.mkdir()) {
412412
throw new IOException();

unicodetools/src/main/resources/org/unicode/props/IndexPropertyRegex.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -197,23 +197,23 @@ NC_Version ; SINGLE_VALUED ; [0-9]\.[0-9]\.[0-9]
197197
# All not listed are SINGLE_VALUED ; null
198198
# =============================
199199

200-
Script_Extensions ; MULTI_VALUED ; <enum>
201-
Standardized_Variant ; MULTI_VALUED ; .*
200+
Script_Extensions ; MULTI_VALUED ; <enum>
201+
Standardized_Variant ; MULTI_VALUED ; .*
202202

203-
Idn_Status ; SINGLE_VALUED ; <enum>
204-
Idn_Mapping ; SINGLE_VALUED ; $codePoints
205-
Idn_2008 ; SINGLE_VALUED ; <enum>
203+
Idn_Status ; SINGLE_VALUED ; <enum>
204+
Idn_Mapping ; SINGLE_VALUED ; $codePoints
205+
Idn_2008 ; SINGLE_VALUED ; <enum>
206206

207-
Identifier_Status ; SINGLE_VALUED ; <enum>
208-
Identifier_Type ; MULTI_VALUED ; <enum>
207+
Identifier_Status ; SINGLE_VALUED ; <enum>
208+
Identifier_Type ; MULTI_VALUED ; <enum>
209209

210-
Confusable_SL ; SINGLE_VALUED ; $codePoints
211-
Confusable_SA ; SINGLE_VALUED ; $codePoints
212-
Confusable_ML ; SINGLE_VALUED ; $codePoints
213-
Confusable_MA ; SINGLE_VALUED ; $codePoints
210+
Confusable_SL ; SINGLE_VALUED ; $codePoints
211+
Confusable_SA ; SINGLE_VALUED ; $codePoints
212+
Confusable_ML ; SINGLE_VALUED ; $codePoints
213+
Confusable_MA ; SINGLE_VALUED ; $codePoints
214214

215-
#Emoji ; SINGLE_VALUED ; <enum>
216-
#Emoji_Presentation ; SINGLE_VALUED ; <enum>
217-
#Emoji_Modifier ; SINGLE_VALUED ; <enum>
218-
#Emoji_Modifier_Base ; SINGLE_VALUED ; <enum>
215+
#Emoji ; SINGLE_VALUED ; <enum>
216+
#Emoji_Presentation ; SINGLE_VALUED ; <enum>
217+
#Emoji_Modifier ; SINGLE_VALUED ; <enum>
218+
#Emoji_Modifier_Base ; SINGLE_VALUED ; <enum>
219219

uax/uax42/fragments/properties/Bidi_C.xml renamed to unicodetools/src/main/resources/org/unicode/uax42/fragments/Bidi_C.xml

File renamed without changes.

uax/uax42/fragments/properties/Bidi_M.xml renamed to unicodetools/src/main/resources/org/unicode/uax42/fragments/Bidi_M.xml

File renamed without changes.

uax/uax42/fragments/emoji-data/Emoji.xml renamed to unicodetools/src/main/resources/org/unicode/uax42/fragments/Emoji.xml

File renamed without changes.

uax/uax42/fragments/properties/InCB.xml renamed to unicodetools/src/main/resources/org/unicode/uax42/fragments/InCB.xml

File renamed without changes.

uax/uax42/fragments/properties/InPC.xml renamed to unicodetools/src/main/resources/org/unicode/uax42/fragments/InPC.xml

File renamed without changes.

uax/uax42/fragments/properties/InSC.xml renamed to unicodetools/src/main/resources/org/unicode/uax42/fragments/InSC.xml

File renamed without changes.

0 commit comments

Comments
 (0)