< prev index next >

make/jdk/src/classes/build/tools/cldrconverter/PluralsParseHandler.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 38,48 **** /** * Handles parsing of files in Locale Data Markup Language for * plurals.xml */ ! class PluralsParseHandler extends AbstractLDMLHandler<Object> { @Override public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException { // avoid HTTP traffic to unicode.org if (systemID.startsWith(CLDRConverter.SPPL_LDML_DTD_SYSTEM_ID)) { return new InputSource((new File(CLDRConverter.LOCAL_SPPL_LDML_DTD)).toURI().toString()); --- 38,48 ---- /** * Handles parsing of files in Locale Data Markup Language for * plurals.xml */ ! class PluralsParseHandler extends AbstractLDMLHandler<Map<String, String>> { @Override public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException { // avoid HTTP traffic to unicode.org if (systemID.startsWith(CLDRConverter.SPPL_LDML_DTD_SYSTEM_ID)) { return new InputSource((new File(CLDRConverter.LOCAL_SPPL_LDML_DTD)).toURI().toString());
*** 80,96 **** public void endElement(String uri, String localName, String qName) throws SAXException { assert qName.equals(currentContainer.getqName()) : "current=" + currentContainer.getqName() + ", param=" + qName; switch (qName) { case "pluralRule": assert !(currentContainer instanceof Entry); ! Entry entry = (Entry)currentContainer; final String count = entry.getKey(); final String rule = (String)entry.getValue(); String locales = ((KeyContainer)(currentContainer.getParent())).getKey(); Arrays.stream(locales.split("\\s")) .forEach(loc -> { ! Map<String, String> rules = (Map<String, String>)get(loc); if (rules == null) { rules = new HashMap<>(); put(loc, rules); } if (!count.equals("other")) { --- 80,96 ---- public void endElement(String uri, String localName, String qName) throws SAXException { assert qName.equals(currentContainer.getqName()) : "current=" + currentContainer.getqName() + ", param=" + qName; switch (qName) { case "pluralRule": assert !(currentContainer instanceof Entry); ! Entry<?> entry = (Entry<?>)currentContainer; final String count = entry.getKey(); final String rule = (String)entry.getValue(); String locales = ((KeyContainer)(currentContainer.getParent())).getKey(); Arrays.stream(locales.split("\\s")) .forEach(loc -> { ! Map<String, String> rules = get(loc); if (rules == null) { rules = new HashMap<>(); put(loc, rules); } if (!count.equals("other")) {
< prev index next >