jdk/src/share/classes/javax/swing/text/html/parser/DTD.java
author dmarkov
Thu, 16 Jan 2014 20:51:18 +0400
changeset 23262 41f2413bba45
parent 6862 f66eb6b6a6b9
child 24494 67129b9360d2
permissions -rw-r--r--
8028616: Htmleditorkit parser doesn't handle leading slash (/) Reviewed-by: alexp, alexsch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
6862
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
     2
 * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1299
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1299
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1299
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1299
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 1299
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package javax.swing.text.html.parser;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
6862
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
    28
import sun.awt.AppContext;
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
    29
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.io.PrintStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.io.File;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.io.FileInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.io.InputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.io.IOException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.io.FileNotFoundException;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.io.BufferedInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.io.DataInputStream;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.util.Hashtable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.util.Vector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
import java.util.BitSet;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
import java.util.StringTokenizer;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
import java.util.Enumeration;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
import java.util.Properties;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
import java.net.URL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * The representation of an SGML DTD.  DTD describes a document
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * syntax and is used in parsing of HTML documents.  It contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * a list of elements and their attributes as well as a list of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * entities defined in the DTD.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * @see Element
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * @see AttributeList
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * @see ContentModel
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * @see Parser
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * @author Arthur van Hoff
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
public
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
class DTD implements DTDConstants {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    public String name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    public Vector<Element> elements = new Vector<Element>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    public Hashtable<String,Element> elementHash
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
        = new Hashtable<String,Element>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public Hashtable<Object,Entity> entityHash
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        = new Hashtable<Object,Entity>();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    public final Element pcdata = getElement("#pcdata");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
    public final Element html = getElement("html");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    public final Element meta = getElement("meta");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    public final Element base = getElement("base");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
    public final Element isindex = getElement("isindex");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
    public final Element head = getElement("head");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    public final Element body = getElement("body");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    public final Element applet = getElement("applet");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    public final Element param = getElement("param");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    public final Element p = getElement("p");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    public final Element title = getElement("title");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    final Element style = getElement("style");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    final Element link = getElement("link");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    final Element script = getElement("script");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    public static final int FILE_VERSION = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * Creates a new DTD with the specified name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * @param name the name, as a <code>String</code> of the new DTD
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    protected DTD(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
        this.name = name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
        defEntity("#RE", GENERAL, '\r');
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        defEntity("#RS", GENERAL, '\n');
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
        defEntity("#SPACE", GENERAL, ' ');
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
        defineElement("unknown", EMPTY, false, true, null, null, null, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * Gets the name of the DTD.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * @return the name of the DTD
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    public String getName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
        return name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     * Gets an entity by name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @return the <code>Entity</code> corresponding to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *   <code>name</code> <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    public Entity getEntity(String name) {
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 438
diff changeset
   109
        return entityHash.get(name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * Gets a character entity.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * @return the <code>Entity</code> corresponding to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     *    <code>ch</code> character
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    public Entity getEntity(int ch) {
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 438
diff changeset
   118
        return entityHash.get(Integer.valueOf(ch));
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * Returns <code>true</code> if the element is part of the DTD,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * otherwise returns <code>false</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * @param  name the requested <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * @return <code>true</code> if <code>name</code> exists as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     *   part of the DTD, otherwise returns <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    boolean elementExists(String name) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        return !"unknown".equals(name) && (elementHash.get(name) != null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * Gets an element by name. A new element is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * created if the element doesn't exist.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * @param name the requested <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @return the <code>Element</code> corresponding to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *   <code>name</code>, which may be newly created
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    public Element getElement(String name) {
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 438
diff changeset
   142
        Element e = elementHash.get(name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        if (e == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
            e = new Element(name, elements.size());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
            elements.addElement(e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
            elementHash.put(name, e);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        return e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * Gets an element by index.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * @param index the requested index
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * @return the <code>Element</code> corresponding to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     *   <code>index</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    public Element getElement(int index) {
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 438
diff changeset
   159
        return elements.elementAt(index);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * Defines an entity.  If the <code>Entity</code> specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     * by <code>name</code>, <code>type</code>, and <code>data</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * exists, it is returned; otherwise a new <code>Entity</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * is created and is returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     * @param name the name of the <code>Entity</code> as a <code>String</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
     * @param type the type of the <code>Entity</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
     * @param data the <code>Entity</code>'s data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
     * @return the <code>Entity</code> requested or a new <code>Entity</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     *   if not found
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    public Entity defineEntity(String name, int type, char data[]) {
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 438
diff changeset
   175
        Entity ent = entityHash.get(name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
        if (ent == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
            ent = new Entity(name, type, data);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
            entityHash.put(name, ent);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
            if (((type & GENERAL) != 0) && (data.length == 1)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
                switch (type & ~GENERAL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
                  case CDATA:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                  case SDATA:
438
2ae294e4518c 6613529: Avoid duplicate object creation within JDK packages
dav
parents: 2
diff changeset
   183
                      entityHash.put(Integer.valueOf(data[0]), ent);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                    break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
        return ent;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     * Returns the <code>Element</code> which matches the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * specified parameters.  If one doesn't exist, a new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * one is created and returned.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @param name the name of the <code>Element</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * @param type the type of the <code>Element</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * @param omitStart <code>true</code> if start should be omitted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * @param omitEnd  <code>true</code> if end should be omitted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * @param content  the <code>ContentModel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     * @param atts the <code>AttributeList</code> specifying the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     *    <code>Element</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * @return the <code>Element</code> specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    public Element defineElement(String name, int type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                       boolean omitStart, boolean omitEnd, ContentModel content,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                       BitSet exclusions, BitSet inclusions, AttributeList atts) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        Element e = getElement(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        e.type = type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
        e.oStart = omitStart;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        e.oEnd = omitEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        e.content = content;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        e.exclusions = exclusions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        e.inclusions = inclusions;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        e.atts = atts;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        return e;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * Defines attributes for an {@code Element}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * @param name the name of the <code>Element</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * @param atts the <code>AttributeList</code> specifying the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     *    <code>Element</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    public void defineAttributes(String name, AttributeList atts) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        Element e = getElement(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
        e.atts = atts;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * Creates and returns a character <code>Entity</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     * @param name the entity's name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
     * @return the new character <code>Entity</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    public Entity defEntity(String name, int type, int ch) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        char data[] = {(char)ch};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        return defineEntity(name, type, data);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * Creates and returns an <code>Entity</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @param name the entity's name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @return the new <code>Entity</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    protected Entity defEntity(String name, int type, String str) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        int len = str.length();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        char data[] = new char[len];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        str.getChars(0, len, data, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        return defineEntity(name, type, data);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * Creates and returns an <code>Element</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * @param name the element's name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * @return the new <code>Element</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    protected Element defElement(String name, int type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                       boolean omitStart, boolean omitEnd, ContentModel content,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                       String[] exclusions, String[] inclusions, AttributeList atts) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
        BitSet excl = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
        if (exclusions != null && exclusions.length > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
            excl = new BitSet();
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 438
diff changeset
   264
            for (String str : exclusions) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                if (str.length() > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
                    excl.set(getElement(str).getIndex());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
        BitSet incl = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
        if (inclusions != null && inclusions.length > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
            incl = new BitSet();
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 438
diff changeset
   273
            for (String str : inclusions) {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
                if (str.length() > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
                    incl.set(getElement(str).getIndex());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        return defineElement(name, type, omitStart, omitEnd, content, excl, incl, atts);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * Creates and returns an <code>AttributeList</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * @param name the attribute list's name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * @return the new <code>AttributeList</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    protected AttributeList defAttributeList(String name, int type, int modifier, String value, String values, AttributeList atts) {
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 438
diff changeset
   288
        Vector<String> vals = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
        if (values != null) {
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 438
diff changeset
   290
            vals = new Vector<String>();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
            for (StringTokenizer s = new StringTokenizer(values, "|") ; s.hasMoreTokens() ;) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
                String str = s.nextToken();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
                if (str.length() > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
                    vals.addElement(str);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
        return new AttributeList(name, type, modifier, value, vals, atts);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * Creates and returns a new content model.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * @param type the type of the new content model
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * @return the new <code>ContentModel</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    protected ContentModel defContentModel(int type, Object obj, ContentModel next) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
        return new ContentModel(type, obj, next);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     * Returns a string representation of this DTD.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * @return the string representation of this DTD
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
        return name;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    /**
6862
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   319
     * The hashtable key of DTDs in AppContext.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     */
6862
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   321
    private static final Object DTD_HASH_KEY = new Object();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
6862
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   323
    public static void putDTDHash(String name, DTD dtd) {
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   324
        getDtdHash().put(name, dtd);
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   325
    }
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   326
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
     * Returns a DTD with the specified <code>name</code>.  If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * a DTD with that name doesn't exist, one is created
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * and returned.  Any uppercase characters in the name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * are converted to lowercase.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * @param name the name of the DTD
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * @return the DTD which corresponds to <code>name</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    public static DTD getDTD(String name) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
        name = name.toLowerCase();
6862
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   338
        DTD dtd = getDtdHash().get(name);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
        if (dtd == null)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
          dtd = new DTD(name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
        return dtd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
6862
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   345
    private static Hashtable<String, DTD> getDtdHash() {
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   346
        AppContext appContext = AppContext.getAppContext();
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   347
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   348
        Hashtable<String, DTD> result = (Hashtable<String, DTD>) appContext.get(DTD_HASH_KEY);
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   349
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   350
        if (result == null) {
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   351
            result = new Hashtable<String, DTD>();
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   352
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   353
            appContext.put(DTD_HASH_KEY, result);
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   354
        }
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   355
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   356
        return result;
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   357
    }
f66eb6b6a6b9 6938813: Swing mutable statics
rupashka
parents: 5506
diff changeset
   358
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * Recreates a DTD from an archived format.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     * @param in  the <code>DataInputStream</code> to read from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    public void read(DataInputStream in) throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
        if (in.readInt() != FILE_VERSION) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        // Read the list of names
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        String[] names = new String[in.readShort()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        for (int i = 0; i < names.length; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
            names[i] = in.readUTF();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
        // Read the entities
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        int num = in.readShort();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        for (int i = 0; i < num; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
            short nameId = in.readShort();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
            int type = in.readByte();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
            String name = in.readUTF();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
            defEntity(names[nameId], type | GENERAL, name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
        // Read the elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
        //
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
        num = in.readShort();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
        for (int i = 0; i < num; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
            short nameId = in.readShort();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
            int type = in.readByte();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
            byte flags = in.readByte();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
            ContentModel m = readContentModel(in, names);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
            String[] exclusions = readNameArray(in, names);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
            String[] inclusions = readNameArray(in, names);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
            AttributeList atts = readAttributeList(in, names);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
            defElement(names[nameId], type,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
                       ((flags & 0x01) != 0), ((flags & 0x02) != 0),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
                       m, exclusions, inclusions, atts);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    private ContentModel readContentModel(DataInputStream in, String[] names)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
                throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        byte flag = in.readByte();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
        switch(flag) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
            case 0:             // null
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
                return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
            case 1: {           // content_c
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
                int type = in.readByte();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
                ContentModel m = readContentModel(in, names);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
                ContentModel next = readContentModel(in, names);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
                return defContentModel(type, m, next);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
            case 2: {           // content_e
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                int type = in.readByte();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
                Element el = getElement(names[in.readShort()]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                ContentModel next = readContentModel(in, names);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
                return defContentModel(type, el, next);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
                throw new IOException("bad bdtd");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    private String[] readNameArray(DataInputStream in, String[] names)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
                throws IOException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
        int num = in.readShort();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        if (num == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
            return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        String[] result = new String[num];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
        for (int i = 0; i < num; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
            result[i] = names[in.readShort()];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    private AttributeList readAttributeList(DataInputStream in, String[] names)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
                throws IOException  {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        AttributeList result = null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
        for (int num = in.readByte(); num > 0; --num) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
            short nameId = in.readShort();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
            int type = in.readByte();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
            int modifier = in.readByte();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
            short valueId = in.readShort();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
            String value = (valueId == -1) ? null : names[valueId];
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 438
diff changeset
   450
            Vector<String> values = null;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
            short numValues = in.readShort();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
            if (numValues > 0) {
1287
a04aca99c77a 6722802: Code improvement and warnings removing from the javax.swing.text package
rupashka
parents: 438
diff changeset
   453
                values = new Vector<String>(numValues);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
                for (int i = 0; i < numValues; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
                    values.addElement(names[in.readShort()]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
result = new AttributeList(names[nameId], type, modifier, value,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
                                       values, result);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
            // We reverse the order of the linked list by doing this, but
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
            // that order isn't important.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
        return result;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
}