@@ -332,6 +332,17 @@ public final String getFirstNameAlias() {
332332
333333 public final String getFirstValueAlias (String value ) {
334334 if (valueToFirstValueAlias == null ) _getFirstValueAliasCache ();
335+ if (isMultivalued ) {
336+ List <String > result = new ArrayList <>();
337+ for (String part : value .split ("," )) {
338+ String partAlias = valueToFirstValueAlias .get (part );
339+ if (partAlias == null ) {
340+ throw new IllegalArgumentException (value + " is not a value alias for " + name );
341+ }
342+ result .add (partAlias );
343+ }
344+ return String .join ("," , result );
345+ }
335346 String result = valueToFirstValueAlias .get (value );
336347 if (result == null ) {
337348 throw new IllegalArgumentException (value + " is not a value alias for " + name );
@@ -423,26 +434,28 @@ public UnicodeSet getSet(PatternMatcher matcher, UnicodeSet result) {
423434 }
424435 return addUntested (result , uniformUnassigned );
425436 }
426- List <String > temp = new ArrayList <>(1 ); // to avoid reallocating...
437+ List <String > valueAliases = new ArrayList <>(1 ); // to avoid reallocating...
438+ List <String > partAliases = new ArrayList <>(1 );
427439 UnicodeMap <String > um = getUnicodeMap_internal ();
428440 Iterator <String > it = um .getAvailableValues (null ).iterator ();
429441 main :
430442 while (it .hasNext ()) {
431443 String value = it .next ();
432- temp .clear ();
433- final List <String > valueAliases = getValueAliases (value , temp );
434- Iterator <String > it2 = valueAliases .iterator ();
435- while (it2 .hasNext ()) {
436- String value2 = it2 .next ();
437- // System.out.println("Values:" + value2);
438- if (isMultivalued && value2 .contains ("," )) {
439- for (String part : SPLIT_COMMAS .split (value2 )) {
440- if (matcher .test (part ) || matcher .test (toSkeleton (part ))) {
441- um .keySet (value , result );
442- continue main ;
444+ valueAliases .clear ();
445+ getValueAliases (value , valueAliases );
446+ for (String valueAlias : valueAliases ) {
447+ if (isMultivalued && valueAlias .contains ("," )) {
448+ for (String part : SPLIT_COMMAS .split (valueAlias )) {
449+ partAliases .clear ();
450+ getValueAliases (part , partAliases );
451+ for (String partAlias : partAliases ) {
452+ if (matcher .test (partAlias ) || matcher .test (toSkeleton (partAlias ))) {
453+ um .keySet (value , result );
454+ continue main ;
455+ }
443456 }
444457 }
445- } else if (matcher .test (value2 ) || matcher .test (toSkeleton (value2 ))) {
458+ } else if (matcher .test (valueAlias ) || matcher .test (toSkeleton (valueAlias ))) {
446459 um .keySet (value , result );
447460 continue main ;
448461 }
0 commit comments