private static void printUnicodePropertyValuesAndAliases(String unicodeVersion) throws UnicodeProperties.UnsupportedUnicodeVersionException {
  Pattern versionPattern=Pattern.compile("(\\d+)(?:\\.(\\d+))?(?:\\.\\d+)?");
  Matcher matcher=versionPattern.matcher(unicodeVersion);
  if (!matcher.matches()) {
    throw new UnicodeProperties.UnsupportedUnicodeVersionException();
  }
  String underscoreVersion=matcher.group(1) + (null == matcher.group(2) ? "_0" : "_" + matcher.group(2));
  String[] propertyValues;
  String[] propertyValueAliases;
  try {
    Class<?> clazz=Class.forName("jflex.unicode.data.Unicode_" + underscoreVersion);
    Field field=clazz.getField("propertyValues");
    propertyValues=(String[])field.get(null);
    field=clazz.getField("propertyValueAliases");
    propertyValueAliases=(String[])field.get(null);
  }
 catch (  Exception e) {
    throw new UnicodeProperties.UnsupportedUnicodeVersionException();
  }
  SortedMap<String,SortedSet<String>> propertyValuesToAliases=new TreeMap<String,SortedSet<String>>();
  for (  String value : propertyValues) {
    propertyValuesToAliases.put(value,new TreeSet<String>());
  }
  for (int i=0; i < propertyValueAliases.length; i+=2) {
    String alias=propertyValueAliases[i];
    String value=propertyValueAliases[i + 1];
    SortedSet<String> aliases=propertyValuesToAliases.get(value);
    if (null == aliases) {
      aliases=new TreeSet<String>();
      propertyValuesToAliases.put(value,aliases);
    }
    aliases.add(alias);
  }
  for (  Map.Entry<String,SortedSet<String>> entry : propertyValuesToAliases.entrySet()) {
    String value=entry.getKey();
    SortedSet<String> aliases=entry.getValue();
    Out.print(value);
    if (aliases.size() > 0) {
      for (      String alias : aliases) {
        Out.print(", " + alias);
      }
    }
    Out.println("");
  }
}

private static void printUnicodePropertyValuesAndAliases ( String unicodeVersion ) throws UnicodeProperties . UnsupportedUnicodeVersionException { Pattern versionPattern = Pattern . compile ( "(\\d+)(?:\\.(\\d+))?(?:\\.\\d+)?" ) ; Matcher matcher = versionPattern . matcher ( unicodeVersion ) ; if ( ! matcher . matches ( ) ) { throw new UnicodeProperties . UnsupportedUnicodeVersionException ( ) ; } String underscoreVersion = matcher . group ( 1 ) + ( null == matcher . group ( 2 ) ? "_0" : "_" + matcher . group ( 2 ) ) ; String [ ] propertyValues ; String [ ] propertyValueAliases ; try { Class < ? > clazz = Class . forName ( "jflex.unicode.data.Unicode_" + underscoreVersion ) ; Field field = clazz . getField ( "propertyValues" ) ; propertyValues = ( String [ ] ) field . get ( null ) ; field = clazz . getField ( "propertyValueAliases" ) ; propertyValueAliases = ( String [ ] ) field . get ( null ) ; } catch ( Exception e ) { throw new UnicodeProperties . UnsupportedUnicodeVersionException ( ) ; } SortedMap < String , SortedSet < String > > propertyValuesToAliases = new TreeMap < String , SortedSet < String > > ( ) ; for ( String value : propertyValues ) { propertyValuesToAliases . put ( value , new TreeSet < String > ( ) ) ; } for ( int i = 0 ; i < propertyValueAliases . length ; i += 2 ) { String alias = propertyValueAliases [ i ] ; String value = propertyValueAliases [ i + 1 ] ; SortedSet < String > aliases = propertyValuesToAliases . get ( value ) ; if ( null == aliases ) { aliases = new TreeSet < String > ( ) ; propertyValuesToAliases . put ( value , aliases ) ; } aliases . add ( alias ) ; } for ( Map . Entry < String , SortedSet < String > > entry : propertyValuesToAliases . entrySet ( ) ) { String value = entry . getKey ( ) ; SortedSet < String > aliases = entry . getValue ( ) ; Out . print ( value ) ; if ( aliases . size ( ) > 0 ) { for ( String alias : aliases ) { Out . print ( ", " + alias ) ; } } Out . println ( "" ) ; } }
prints one unicode property value per line , along with its aliases , if any , for the given unicodeversion .
