< prev index next >

make/src/classes/build/tools/cldrconverter/Bundle.java

Print this page


   1 /*
   2  * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 372                             for (int i = 0; i < names.length; i++) {
 373                                 if (names[i] == null) {
 374                                     names[i] = enNames[i];
 375                                 }
 376                             }
 377                         }
 378                         // If there are still nulls, give up names.
 379                         if (hasNulls(names)) {
 380                             names = null;
 381                         }
 382                     }
 383                 }
 384                 // replace the Map with the array
 385                 if (names != null) {
 386                     myMap.put(key, names);
 387                 } else {
 388                     it.remove();
 389                 }
 390             }
 391         }












 392 
 393         // Remove all duplicates
 394         if (Objects.nonNull(parentsMap)) {
 395             for (Iterator<String> it = myMap.keySet().iterator(); it.hasNext();) {
 396                 String key = it.next();
 397                 if (!key.equals("numberingScripts") && // real body "NumberElements" may differ
 398                     Objects.deepEquals(parentsMap.get(key), myMap.get(key))) {
 399                     it.remove();
 400                 }
 401             }
 402         }
 403 
 404         targetMap = myMap;
 405         return myMap;
 406     }
 407 
 408     private void handleMultipleInheritance(Map<String, Object> map, Map<String, Object> parents, String key) {
 409         String formatKey = key + "/format";
 410         Object format = map.get(formatKey);
 411         if (format != null) {


   1 /*
   2  * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


 372                             for (int i = 0; i < names.length; i++) {
 373                                 if (names[i] == null) {
 374                                     names[i] = enNames[i];
 375                                 }
 376                             }
 377                         }
 378                         // If there are still nulls, give up names.
 379                         if (hasNulls(names)) {
 380                             names = null;
 381                         }
 382                     }
 383                 }
 384                 // replace the Map with the array
 385                 if (names != null) {
 386                     myMap.put(key, names);
 387                 } else {
 388                     it.remove();
 389                 }
 390             }
 391         }
 392         // replace empty era names with parentMap era names
 393         for (String key : ERA_KEYS) {
 394             Object value = myMap.get(key);
 395             if (value != null && value instanceof String[]) {
 396                 String[] eraStrings = (String[]) value;
 397                 for (String eraString : eraStrings) {
 398                     if (eraString == null || eraString.isEmpty()) {
 399                         fillInElements(parentsMap, key, value);
 400                     }
 401                 }
 402             }
 403         }
 404 
 405         // Remove all duplicates
 406         if (Objects.nonNull(parentsMap)) {
 407             for (Iterator<String> it = myMap.keySet().iterator(); it.hasNext();) {
 408                 String key = it.next();
 409                 if (!key.equals("numberingScripts") && // real body "NumberElements" may differ
 410                     Objects.deepEquals(parentsMap.get(key), myMap.get(key))) {
 411                     it.remove();
 412                 }
 413             }
 414         }
 415 
 416         targetMap = myMap;
 417         return myMap;
 418     }
 419 
 420     private void handleMultipleInheritance(Map<String, Object> map, Map<String, Object> parents, String key) {
 421         String formatKey = key + "/format";
 422         Object format = map.get(formatKey);
 423         if (format != null) {


< prev index next >