< prev index next >

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

Print this page


   1 /*
   2  * Copyright (c) 2012, 2015, 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


 133     /**
 134      * start an element that defines a string entry, with the value provided by an attribute value.
 135      */
 136     void pushStringEntry(String qName, Attributes attributes, String key, String value) {
 137         if (!pushIfIgnored(qName, attributes)) {
 138             currentContainer = new StringEntry(qName, currentContainer, key, value);
 139         }
 140     }
 141 
 142     void pushStringArrayEntry(String qName, Attributes attributes, String key, int length) {
 143         if (!pushIfIgnored(qName, attributes)) {
 144             currentContainer = new StringArrayEntry(qName, currentContainer, key, length);
 145         }
 146     }
 147 
 148     void pushStringArrayElement(String qName, Attributes attributes, int index) {
 149         if (!pushIfIgnored(qName, attributes)) {
 150             currentContainer = new StringArrayElement(qName, currentContainer, index);
 151         }
 152     }













 153 
 154     private boolean pushIfIgnored(String qName, Attributes attributes) {
 155         if (isIgnored(attributes) || currentContainer instanceof IgnoredContainer) {
 156             pushIgnoredContainer(qName);
 157             return true;
 158         }
 159         return false;
 160     }
 161 
 162     /**
 163      * Obtains the key from the innermost containing container that provides one.
 164      */
 165     String getContainerKey() {
 166         Container current = currentContainer;
 167         while (current != null) {
 168             if (current instanceof KeyContainer) {
 169                 return ((KeyContainer) current).getKey();
 170             }
 171             current = current.getParent();
 172         }


   1 /*
   2  * Copyright (c) 2012, 2018, 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


 133     /**
 134      * start an element that defines a string entry, with the value provided by an attribute value.
 135      */
 136     void pushStringEntry(String qName, Attributes attributes, String key, String value) {
 137         if (!pushIfIgnored(qName, attributes)) {
 138             currentContainer = new StringEntry(qName, currentContainer, key, value);
 139         }
 140     }
 141 
 142     void pushStringArrayEntry(String qName, Attributes attributes, String key, int length) {
 143         if (!pushIfIgnored(qName, attributes)) {
 144             currentContainer = new StringArrayEntry(qName, currentContainer, key, length);
 145         }
 146     }
 147 
 148     void pushStringArrayElement(String qName, Attributes attributes, int index) {
 149         if (!pushIfIgnored(qName, attributes)) {
 150             currentContainer = new StringArrayElement(qName, currentContainer, index);
 151         }
 152     }
 153 
 154     void pushStringListEntry(String qName, Attributes attributes, String key) {
 155         if (!pushIfIgnored(qName, attributes)) {
 156             currentContainer = new StringListEntry(qName, currentContainer, key);
 157         }
 158     }
 159 
 160     void pushStringListElement(String qName, Attributes attributes, int index) {
 161         if (!pushIfIgnored(qName, attributes)) {
 162             currentContainer = new StringListElement(qName, currentContainer, index);
 163         }
 164     }
 165 
 166 
 167     private boolean pushIfIgnored(String qName, Attributes attributes) {
 168         if (isIgnored(attributes) || currentContainer instanceof IgnoredContainer) {
 169             pushIgnoredContainer(qName);
 170             return true;
 171         }
 172         return false;
 173     }
 174 
 175     /**
 176      * Obtains the key from the innermost containing container that provides one.
 177      */
 178     String getContainerKey() {
 179         Container current = currentContainer;
 180         while (current != null) {
 181             if (current instanceof KeyContainer) {
 182                 return ((KeyContainer) current).getKey();
 183             }
 184             current = current.getParent();
 185         }


< prev index next >