feat(jdk8): move files to new folder to avoid resources compiled.
This commit is contained in:
@@ -0,0 +1,294 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2011, 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
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
* THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.fastinfoset.vocab;
|
||||
|
||||
import com.sun.xml.internal.fastinfoset.EncodingConstants;
|
||||
import com.sun.xml.internal.fastinfoset.QualifiedName;
|
||||
import com.sun.xml.internal.fastinfoset.util.CharArray;
|
||||
import com.sun.xml.internal.fastinfoset.util.CharArrayArray;
|
||||
import com.sun.xml.internal.fastinfoset.util.ContiguousCharArrayArray;
|
||||
import com.sun.xml.internal.fastinfoset.util.DuplicateAttributeVerifier;
|
||||
import com.sun.xml.internal.fastinfoset.util.FixedEntryStringIntMap;
|
||||
import com.sun.xml.internal.fastinfoset.util.KeyIntMap;
|
||||
import com.sun.xml.internal.fastinfoset.util.PrefixArray;
|
||||
import com.sun.xml.internal.fastinfoset.util.QualifiedNameArray;
|
||||
import com.sun.xml.internal.fastinfoset.util.StringArray;
|
||||
import com.sun.xml.internal.fastinfoset.util.StringIntMap;
|
||||
import com.sun.xml.internal.fastinfoset.util.ValueArray;
|
||||
import java.util.Iterator;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
public class ParserVocabulary extends Vocabulary {
|
||||
public static final String IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS_PEOPERTY =
|
||||
"com.sun.xml.internal.fastinfoset.vocab.ParserVocabulary.IdentifyingStringTable.maximumItems";
|
||||
public static final String NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS_PEOPERTY =
|
||||
"com.sun.xml.internal.fastinfoset.vocab.ParserVocabulary.NonIdentifyingStringTable.maximumItems";
|
||||
public static final String NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS_PEOPERTY =
|
||||
"com.sun.xml.internal.fastinfoset.vocab.ParserVocabulary.NonIdentifyingStringTable.maximumCharacters";
|
||||
|
||||
protected static final int IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS =
|
||||
getIntegerValueFromProperty(IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS_PEOPERTY);
|
||||
protected static final int NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS =
|
||||
getIntegerValueFromProperty(NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS_PEOPERTY);
|
||||
protected static final int NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS =
|
||||
getIntegerValueFromProperty(NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS_PEOPERTY);
|
||||
|
||||
private static int getIntegerValueFromProperty(String property) {
|
||||
String value = System.getProperty(property);
|
||||
if (value == null) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
try {
|
||||
return Math.max(Integer.parseInt(value), ValueArray.DEFAULT_CAPACITY);
|
||||
} catch (NumberFormatException e) {
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
public final CharArrayArray restrictedAlphabet = new CharArrayArray(ValueArray.DEFAULT_CAPACITY, 256);
|
||||
public final StringArray encodingAlgorithm = new StringArray(ValueArray.DEFAULT_CAPACITY, 256, true);
|
||||
|
||||
public final StringArray namespaceName;
|
||||
public final PrefixArray prefix;
|
||||
public final StringArray localName;
|
||||
public final StringArray otherNCName ;
|
||||
public final StringArray otherURI;
|
||||
public final StringArray attributeValue;
|
||||
public final CharArrayArray otherString;
|
||||
|
||||
public final ContiguousCharArrayArray characterContentChunk;
|
||||
|
||||
public final QualifiedNameArray elementName;
|
||||
public final QualifiedNameArray attributeName;
|
||||
|
||||
public final ValueArray[] tables = new ValueArray[12];
|
||||
|
||||
protected SerializerVocabulary _readOnlyVocabulary;
|
||||
|
||||
/** Creates a new instance of ParserVocabulary */
|
||||
public ParserVocabulary() {
|
||||
namespaceName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
|
||||
prefix = new PrefixArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
|
||||
localName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
|
||||
otherNCName = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, false);
|
||||
otherURI = new StringArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
|
||||
attributeValue = new StringArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS, true);
|
||||
otherString = new CharArrayArray(ValueArray.DEFAULT_CAPACITY, NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
|
||||
|
||||
characterContentChunk = new ContiguousCharArrayArray(ValueArray.DEFAULT_CAPACITY,
|
||||
NON_IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS,
|
||||
ContiguousCharArrayArray.INITIAL_CHARACTER_SIZE,
|
||||
NON_IDENTIFYING_STRING_TABLE_MAXIMUM_CHARACTERS);
|
||||
|
||||
elementName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
|
||||
attributeName = new QualifiedNameArray(ValueArray.DEFAULT_CAPACITY, IDENTIFYING_STRING_TABLE_MAXIMUM_ITEMS);
|
||||
|
||||
tables[RESTRICTED_ALPHABET] = restrictedAlphabet;
|
||||
tables[ENCODING_ALGORITHM] = encodingAlgorithm;
|
||||
tables[PREFIX] = prefix;
|
||||
tables[NAMESPACE_NAME] = namespaceName;
|
||||
tables[LOCAL_NAME] = localName;
|
||||
tables[OTHER_NCNAME] = otherNCName;
|
||||
tables[OTHER_URI] = otherURI;
|
||||
tables[ATTRIBUTE_VALUE] = attributeValue;
|
||||
tables[OTHER_STRING] = otherString;
|
||||
tables[CHARACTER_CONTENT_CHUNK] = characterContentChunk;
|
||||
tables[ELEMENT_NAME] = elementName;
|
||||
tables[ATTRIBUTE_NAME] = attributeName;
|
||||
}
|
||||
|
||||
|
||||
public ParserVocabulary(com.sun.xml.internal.org.jvnet.fastinfoset.Vocabulary v) {
|
||||
this();
|
||||
|
||||
convertVocabulary(v);
|
||||
}
|
||||
|
||||
void setReadOnlyVocabulary(ParserVocabulary readOnlyVocabulary, boolean clear) {
|
||||
for (int i = 0; i < tables.length; i++) {
|
||||
tables[i].setReadOnlyArray(readOnlyVocabulary.tables[i], clear);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInitialVocabulary(ParserVocabulary initialVocabulary, boolean clear) {
|
||||
setExternalVocabularyURI(null);
|
||||
setInitialReadOnlyVocabulary(true);
|
||||
setReadOnlyVocabulary(initialVocabulary, clear);
|
||||
}
|
||||
|
||||
public void setReferencedVocabulary(String referencedVocabularyURI, ParserVocabulary referencedVocabulary, boolean clear) {
|
||||
if (!referencedVocabularyURI.equals(getExternalVocabularyURI())) {
|
||||
setInitialReadOnlyVocabulary(false);
|
||||
setExternalVocabularyURI(referencedVocabularyURI);
|
||||
setReadOnlyVocabulary(referencedVocabulary, clear);
|
||||
}
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
for (int i = 0; i < tables.length; i++) {
|
||||
tables[i].clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void convertVocabulary(com.sun.xml.internal.org.jvnet.fastinfoset.Vocabulary v) {
|
||||
final StringIntMap prefixMap = new FixedEntryStringIntMap(
|
||||
EncodingConstants.XML_NAMESPACE_PREFIX, 8);
|
||||
final StringIntMap namespaceNameMap = new FixedEntryStringIntMap(
|
||||
EncodingConstants.XML_NAMESPACE_NAME, 8);
|
||||
final StringIntMap localNameMap = new StringIntMap();
|
||||
|
||||
addToTable(v.restrictedAlphabets.iterator(), restrictedAlphabet);
|
||||
addToTable(v.encodingAlgorithms.iterator(), encodingAlgorithm);
|
||||
addToTable(v.prefixes.iterator(), prefix, prefixMap);
|
||||
addToTable(v.namespaceNames.iterator(), namespaceName, namespaceNameMap);
|
||||
addToTable(v.localNames.iterator(), localName, localNameMap);
|
||||
addToTable(v.otherNCNames.iterator(), otherNCName);
|
||||
addToTable(v.otherURIs.iterator(), otherURI);
|
||||
addToTable(v.attributeValues.iterator(), attributeValue);
|
||||
addToTable(v.otherStrings.iterator(), otherString);
|
||||
addToTable(v.characterContentChunks.iterator(), characterContentChunk);
|
||||
addToTable(v.elements.iterator(), elementName, false,
|
||||
prefixMap, namespaceNameMap, localNameMap);
|
||||
addToTable(v.attributes.iterator(), attributeName, true,
|
||||
prefixMap, namespaceNameMap, localNameMap);
|
||||
}
|
||||
|
||||
private void addToTable(Iterator i, StringArray a) {
|
||||
while (i.hasNext()) {
|
||||
addToTable((String)i.next(), a, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void addToTable(Iterator i, StringArray a, StringIntMap m) {
|
||||
while (i.hasNext()) {
|
||||
addToTable((String)i.next(), a, m);
|
||||
}
|
||||
}
|
||||
|
||||
private void addToTable(String s, StringArray a, StringIntMap m) {
|
||||
if (s.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m != null) m.obtainIndex(s);
|
||||
a.add(s);
|
||||
}
|
||||
|
||||
private void addToTable(Iterator i, PrefixArray a, StringIntMap m) {
|
||||
while (i.hasNext()) {
|
||||
addToTable((String)i.next(), a, m);
|
||||
}
|
||||
}
|
||||
|
||||
private void addToTable(String s, PrefixArray a, StringIntMap m) {
|
||||
if (s.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m != null) m.obtainIndex(s);
|
||||
a.add(s);
|
||||
}
|
||||
|
||||
private void addToTable(Iterator i, ContiguousCharArrayArray a) {
|
||||
while (i.hasNext()) {
|
||||
addToTable((String)i.next(), a);
|
||||
}
|
||||
}
|
||||
|
||||
private void addToTable(String s, ContiguousCharArrayArray a) {
|
||||
if (s.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
char[] c = s.toCharArray();
|
||||
a.add(c, c.length);
|
||||
}
|
||||
|
||||
private void addToTable(Iterator i, CharArrayArray a) {
|
||||
while (i.hasNext()) {
|
||||
addToTable((String)i.next(), a);
|
||||
}
|
||||
}
|
||||
|
||||
private void addToTable(String s, CharArrayArray a) {
|
||||
if (s.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
char[] c = s.toCharArray();
|
||||
a.add(new CharArray(c, 0, c.length, false));
|
||||
}
|
||||
|
||||
private void addToTable(Iterator i, QualifiedNameArray a,
|
||||
boolean isAttribute,
|
||||
StringIntMap prefixMap, StringIntMap namespaceNameMap,
|
||||
StringIntMap localNameMap) {
|
||||
while (i.hasNext()) {
|
||||
addToNameTable((QName)i.next(), a, isAttribute,
|
||||
prefixMap, namespaceNameMap, localNameMap);
|
||||
}
|
||||
}
|
||||
|
||||
private void addToNameTable(QName n, QualifiedNameArray a,
|
||||
boolean isAttribute,
|
||||
StringIntMap prefixMap, StringIntMap namespaceNameMap,
|
||||
StringIntMap localNameMap) {
|
||||
int namespaceURIIndex = -1;
|
||||
int prefixIndex = -1;
|
||||
if (n.getNamespaceURI().length() > 0) {
|
||||
namespaceURIIndex = namespaceNameMap.obtainIndex(n.getNamespaceURI());
|
||||
if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) {
|
||||
namespaceURIIndex = namespaceName.getSize();
|
||||
namespaceName.add(n.getNamespaceURI());
|
||||
}
|
||||
|
||||
if (n.getPrefix().length() > 0) {
|
||||
prefixIndex = prefixMap.obtainIndex(n.getPrefix());
|
||||
if (prefixIndex == KeyIntMap.NOT_PRESENT) {
|
||||
prefixIndex = prefix.getSize();
|
||||
prefix.add(n.getPrefix());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int localNameIndex = localNameMap.obtainIndex(n.getLocalPart());
|
||||
if (localNameIndex == KeyIntMap.NOT_PRESENT) {
|
||||
localNameIndex = localName.getSize();
|
||||
localName.add(n.getLocalPart());
|
||||
}
|
||||
|
||||
QualifiedName name = new QualifiedName(n.getPrefix(), n.getNamespaceURI(), n.getLocalPart(),
|
||||
a.getSize(),
|
||||
prefixIndex, namespaceURIIndex, localNameIndex);
|
||||
if (isAttribute) {
|
||||
name.createAttributeValues(DuplicateAttributeVerifier.MAP_SIZE);
|
||||
}
|
||||
a.add(name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2011, 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
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
* THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.fastinfoset.vocab;
|
||||
|
||||
import com.sun.xml.internal.fastinfoset.EncodingConstants;
|
||||
import com.sun.xml.internal.fastinfoset.QualifiedName;
|
||||
import com.sun.xml.internal.fastinfoset.util.CharArrayIntMap;
|
||||
import com.sun.xml.internal.fastinfoset.util.FixedEntryStringIntMap;
|
||||
import com.sun.xml.internal.fastinfoset.util.KeyIntMap;
|
||||
import com.sun.xml.internal.fastinfoset.util.LocalNameQualifiedNamesMap;
|
||||
import com.sun.xml.internal.fastinfoset.util.StringIntMap;
|
||||
import java.util.Iterator;
|
||||
import javax.xml.namespace.QName;
|
||||
|
||||
public class SerializerVocabulary extends Vocabulary {
|
||||
public final StringIntMap restrictedAlphabet;
|
||||
public final StringIntMap encodingAlgorithm;
|
||||
|
||||
public final StringIntMap namespaceName;
|
||||
public final StringIntMap prefix;
|
||||
public final StringIntMap localName;
|
||||
public final StringIntMap otherNCName;
|
||||
public final StringIntMap otherURI;
|
||||
public final StringIntMap attributeValue;
|
||||
public final CharArrayIntMap otherString;
|
||||
|
||||
public final CharArrayIntMap characterContentChunk;
|
||||
|
||||
public final LocalNameQualifiedNamesMap elementName;
|
||||
public final LocalNameQualifiedNamesMap attributeName;
|
||||
|
||||
public final KeyIntMap[] tables = new KeyIntMap[12];
|
||||
|
||||
protected boolean _useLocalNameAsKey;
|
||||
|
||||
protected SerializerVocabulary _readOnlyVocabulary;
|
||||
|
||||
public SerializerVocabulary() {
|
||||
tables[RESTRICTED_ALPHABET] = restrictedAlphabet = new StringIntMap(4);
|
||||
tables[ENCODING_ALGORITHM] = encodingAlgorithm = new StringIntMap(4);
|
||||
tables[PREFIX] = prefix = new FixedEntryStringIntMap(EncodingConstants.XML_NAMESPACE_PREFIX, 8);
|
||||
tables[NAMESPACE_NAME] = namespaceName = new FixedEntryStringIntMap(EncodingConstants.XML_NAMESPACE_NAME, 8);
|
||||
tables[LOCAL_NAME] = localName = new StringIntMap();
|
||||
tables[OTHER_NCNAME] = otherNCName = new StringIntMap(4);
|
||||
tables[OTHER_URI] = otherURI = new StringIntMap(4);
|
||||
tables[ATTRIBUTE_VALUE] = attributeValue = new StringIntMap();
|
||||
tables[OTHER_STRING] = otherString = new CharArrayIntMap(4);
|
||||
tables[CHARACTER_CONTENT_CHUNK] = characterContentChunk = new CharArrayIntMap();
|
||||
tables[ELEMENT_NAME] = elementName = new LocalNameQualifiedNamesMap();
|
||||
tables[ATTRIBUTE_NAME] = attributeName = new LocalNameQualifiedNamesMap();
|
||||
}
|
||||
|
||||
public SerializerVocabulary(com.sun.xml.internal.org.jvnet.fastinfoset.Vocabulary v,
|
||||
boolean useLocalNameAsKey) {
|
||||
this();
|
||||
|
||||
_useLocalNameAsKey = useLocalNameAsKey;
|
||||
convertVocabulary(v);
|
||||
}
|
||||
|
||||
public SerializerVocabulary getReadOnlyVocabulary() {
|
||||
return _readOnlyVocabulary;
|
||||
}
|
||||
|
||||
protected void setReadOnlyVocabulary(SerializerVocabulary readOnlyVocabulary,
|
||||
boolean clear) {
|
||||
for (int i = 0; i < tables.length; i++) {
|
||||
tables[i].setReadOnlyMap(readOnlyVocabulary.tables[i], clear);
|
||||
}
|
||||
}
|
||||
|
||||
public void setInitialVocabulary(SerializerVocabulary initialVocabulary,
|
||||
boolean clear) {
|
||||
setExternalVocabularyURI(null);
|
||||
setInitialReadOnlyVocabulary(true);
|
||||
setReadOnlyVocabulary(initialVocabulary, clear);
|
||||
}
|
||||
|
||||
public void setExternalVocabulary(String externalVocabularyURI,
|
||||
SerializerVocabulary externalVocabulary, boolean clear) {
|
||||
setInitialReadOnlyVocabulary(false);
|
||||
setExternalVocabularyURI(externalVocabularyURI);
|
||||
setReadOnlyVocabulary(externalVocabulary, clear);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
for (int i = 0; i < tables.length; i++) {
|
||||
tables[i].clear();
|
||||
}
|
||||
}
|
||||
|
||||
private void convertVocabulary(com.sun.xml.internal.org.jvnet.fastinfoset.Vocabulary v) {
|
||||
addToTable(v.restrictedAlphabets.iterator(), restrictedAlphabet);
|
||||
addToTable(v.encodingAlgorithms.iterator(), encodingAlgorithm);
|
||||
addToTable(v.prefixes.iterator(), prefix);
|
||||
addToTable(v.namespaceNames.iterator(), namespaceName);
|
||||
addToTable(v.localNames.iterator(), localName);
|
||||
addToTable(v.otherNCNames.iterator(), otherNCName);
|
||||
addToTable(v.otherURIs.iterator(), otherURI);
|
||||
addToTable(v.attributeValues.iterator(), attributeValue);
|
||||
addToTable(v.otherStrings.iterator(), otherString);
|
||||
addToTable(v.characterContentChunks.iterator(), characterContentChunk);
|
||||
addToTable(v.elements.iterator(), elementName);
|
||||
addToTable(v.attributes.iterator(), attributeName);
|
||||
}
|
||||
|
||||
private void addToTable(Iterator i, StringIntMap m) {
|
||||
while (i.hasNext()) {
|
||||
addToTable((String)i.next(), m);
|
||||
}
|
||||
}
|
||||
|
||||
private void addToTable(String s, StringIntMap m) {
|
||||
if (s.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
m.obtainIndex(s);
|
||||
}
|
||||
|
||||
private void addToTable(Iterator i, CharArrayIntMap m) {
|
||||
while (i.hasNext()) {
|
||||
addToTable((String)i.next(), m);
|
||||
}
|
||||
}
|
||||
|
||||
private void addToTable(String s, CharArrayIntMap m) {
|
||||
if (s.length() == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
char[] c = s.toCharArray();
|
||||
m.obtainIndex(c, 0, c.length, false);
|
||||
}
|
||||
|
||||
private void addToTable(Iterator i, LocalNameQualifiedNamesMap m) {
|
||||
while (i.hasNext()) {
|
||||
addToNameTable((QName)i.next(), m);
|
||||
}
|
||||
}
|
||||
|
||||
private void addToNameTable(QName n, LocalNameQualifiedNamesMap m) {
|
||||
int namespaceURIIndex = -1;
|
||||
int prefixIndex = -1;
|
||||
if (n.getNamespaceURI().length() > 0) {
|
||||
namespaceURIIndex = namespaceName.obtainIndex(n.getNamespaceURI());
|
||||
if (namespaceURIIndex == KeyIntMap.NOT_PRESENT) {
|
||||
namespaceURIIndex = namespaceName.get(n.getNamespaceURI());
|
||||
}
|
||||
|
||||
if (n.getPrefix().length() > 0) {
|
||||
prefixIndex = prefix.obtainIndex(n.getPrefix());
|
||||
if (prefixIndex == KeyIntMap.NOT_PRESENT) {
|
||||
prefixIndex = prefix.get(n.getPrefix());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int localNameIndex = localName.obtainIndex(n.getLocalPart());
|
||||
if (localNameIndex == KeyIntMap.NOT_PRESENT) {
|
||||
localNameIndex = localName.get(n.getLocalPart());
|
||||
}
|
||||
|
||||
QualifiedName name = new QualifiedName(n.getPrefix(), n.getNamespaceURI(), n.getLocalPart(),
|
||||
m.getNextIndex(),
|
||||
prefixIndex, namespaceURIIndex, localNameIndex);
|
||||
|
||||
LocalNameQualifiedNamesMap.Entry entry = null;
|
||||
if (_useLocalNameAsKey) {
|
||||
entry = m.obtainEntry(n.getLocalPart());
|
||||
} else {
|
||||
String qName = (prefixIndex == -1)
|
||||
? n.getLocalPart()
|
||||
: n.getPrefix() + ":" + n.getLocalPart();
|
||||
entry = m.obtainEntry(qName);
|
||||
}
|
||||
|
||||
entry.addQualifiedName(name);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2011, 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
|
||||
* particular file as subject to the "Classpath" exception as provided
|
||||
* by Oracle in the LICENSE file that accompanied this code.
|
||||
*
|
||||
* This code is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
* version 2 for more details (a copy is included in the LICENSE file that
|
||||
* accompanied this code).
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License version
|
||||
* 2 along with this work; if not, write to the Free Software Foundation,
|
||||
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
|
||||
* or visit www.oracle.com if you need additional information or have any
|
||||
* questions.
|
||||
*
|
||||
* THIS FILE WAS MODIFIED BY SUN MICROSYSTEMS, INC.
|
||||
*/
|
||||
|
||||
package com.sun.xml.internal.fastinfoset.vocab;
|
||||
|
||||
|
||||
public abstract class Vocabulary {
|
||||
public static final int RESTRICTED_ALPHABET = 0;
|
||||
public static final int ENCODING_ALGORITHM = 1;
|
||||
public static final int PREFIX = 2;
|
||||
public static final int NAMESPACE_NAME = 3;
|
||||
public static final int LOCAL_NAME = 4;
|
||||
public static final int OTHER_NCNAME = 5;
|
||||
public static final int OTHER_URI = 6;
|
||||
public static final int ATTRIBUTE_VALUE = 7;
|
||||
public static final int OTHER_STRING = 8;
|
||||
public static final int CHARACTER_CONTENT_CHUNK = 9;
|
||||
public static final int ELEMENT_NAME = 10;
|
||||
public static final int ATTRIBUTE_NAME = 11;
|
||||
|
||||
protected boolean _hasInitialReadOnlyVocabulary;
|
||||
|
||||
protected String _referencedVocabularyURI;
|
||||
|
||||
public boolean hasInitialVocabulary() {
|
||||
return _hasInitialReadOnlyVocabulary;
|
||||
}
|
||||
|
||||
protected void setInitialReadOnlyVocabulary(boolean hasInitialReadOnlyVocabulary) {
|
||||
_hasInitialReadOnlyVocabulary = hasInitialReadOnlyVocabulary;
|
||||
}
|
||||
|
||||
public boolean hasExternalVocabulary() {
|
||||
return _referencedVocabularyURI != null;
|
||||
}
|
||||
|
||||
public String getExternalVocabularyURI() {
|
||||
return _referencedVocabularyURI;
|
||||
}
|
||||
|
||||
protected void setExternalVocabularyURI(String referencedVocabularyURI) {
|
||||
_referencedVocabularyURI = referencedVocabularyURI;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user