com.sun.org.apache.xerces.internal.util.SymbolHash

Here are the examples of the java api class com.sun.org.apache.xerces.internal.util.SymbolHash taken from open source projects.

1. XSModelImpl#buildSubGroups_Org()

Project: openjdk
Source File: XSModelImpl.java
View license
private SymbolHash buildSubGroups_Org() {
    SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null);
    for (int i = 0; i < fGrammarCount; i++) {
        sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups());
    }
    final XSNamedMap elements = getComponents(XSConstants.ELEMENT_DECLARATION);
    final int len = elements.getLength();
    final SymbolHash subGroupMap = new SymbolHash(len * 2);
    XSElementDecl head;
    XSElementDeclaration[] subGroup;
    for (int i = 0; i < len; i++) {
        head = (XSElementDecl) elements.item(i);
        subGroup = sgHandler.getSubstitutionGroup(head);
        subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST);
    }
    return subGroupMap;
}

2. XSModelImpl#buildSubGroups()

Project: openjdk
Source File: XSModelImpl.java
View license
private SymbolHash buildSubGroups() {
    SubstitutionGroupHandler sgHandler = new SubstitutionGroupHandler(null);
    for (int i = 0; i < fGrammarCount; i++) {
        sgHandler.addSubstitutionGroup(fGrammarList[i].getSubstitutionGroups());
    }
    final XSObjectListImpl elements = getGlobalElements();
    final int len = elements.getLength();
    final SymbolHash subGroupMap = new SymbolHash(len * 2);
    XSElementDecl head;
    XSElementDeclaration[] subGroup;
    for (int i = 0; i < len; i++) {
        head = (XSElementDecl) elements.item(i);
        subGroup = sgHandler.getSubstitutionGroup(head);
        subGroupMap.put(head, subGroup.length > 0 ? new XSObjectListImpl(subGroup, subGroup.length) : XSObjectListImpl.EMPTY_LIST);
    }
    return subGroupMap;
}

3. XSModelImpl#getGlobalElements()

Project: openjdk
Source File: XSModelImpl.java
View license
private XSObjectListImpl getGlobalElements() {
    final SymbolHash[] tables = new SymbolHash[fGrammarCount];
    int length = 0;
    for (int i = 0; i < fGrammarCount; i++) {
        tables[i] = fGrammarList[i].fAllGlobalElemDecls;
        length += tables[i].getLength();
    }
    if (length == 0) {
        return XSObjectListImpl.EMPTY_LIST;
    }
    final XSObject[] components = new XSObject[length];
    int start = 0;
    for (int i = 0; i < fGrammarCount; i++) {
        tables[i].getValues(components, start);
        start += tables[i].getLength();
    }
    return new XSObjectListImpl(components, length);
}

4. XSModelImpl#getComponents()

Project: openjdk
Source File: XSModelImpl.java
View license
/**
     * Returns a list of top-level components, i.e. element declarations,
     * attribute declarations, etc.
     * @param objectType The type of the declaration, i.e.
     *   <code>ELEMENT_DECLARATION</code>. Note that
     *   <code>XSTypeDefinition.SIMPLE_TYPE</code> and
     *   <code>XSTypeDefinition.COMPLEX_TYPE</code> can also be used as the
     *   <code>objectType</code> to retrieve only complex types or simple
     *   types, instead of all types.
     * @return  A list of top-level definitions of the specified type in
     *   <code>objectType</code> or an empty <code>XSNamedMap</code> if no
     *   such definitions exist.
     */
public synchronized XSNamedMap getComponents(short objectType) {
    if (objectType <= 0 || objectType > MAX_COMP_IDX || !GLOBAL_COMP[objectType]) {
        return XSNamedMapImpl.EMPTY_MAP;
    }
    SymbolHash[] tables = new SymbolHash[fGrammarCount];
    // get all hashtables from all namespaces for this type of components
    if (fGlobalComponents[objectType] == null) {
        for (int i = 0; i < fGrammarCount; i++) {
            switch(objectType) {
                case XSConstants.TYPE_DEFINITION:
                case XSTypeDefinition.COMPLEX_TYPE:
                case XSTypeDefinition.SIMPLE_TYPE:
                    tables[i] = fGrammarList[i].fGlobalTypeDecls;
                    break;
                case XSConstants.ATTRIBUTE_DECLARATION:
                    tables[i] = fGrammarList[i].fGlobalAttrDecls;
                    break;
                case XSConstants.ELEMENT_DECLARATION:
                    tables[i] = fGrammarList[i].fGlobalElemDecls;
                    break;
                case XSConstants.ATTRIBUTE_GROUP:
                    tables[i] = fGrammarList[i].fGlobalAttrGrpDecls;
                    break;
                case XSConstants.MODEL_GROUP_DEFINITION:
                    tables[i] = fGrammarList[i].fGlobalGroupDecls;
                    break;
                case XSConstants.NOTATION_DECLARATION:
                    tables[i] = fGrammarList[i].fGlobalNotationDecls;
                    break;
                case XSConstants.IDENTITY_CONSTRAINT:
                    tables[i] = fGrammarList[i].fGlobalIDConstraintDecls;
                    break;
            }
        }
        // which take specific types out of the hash table
        if (objectType == XSTypeDefinition.COMPLEX_TYPE || objectType == XSTypeDefinition.SIMPLE_TYPE) {
            fGlobalComponents[objectType] = new XSNamedMap4Types(fNamespaces, tables, fGrammarCount, objectType);
        } else {
            fGlobalComponents[objectType] = new XSNamedMapImpl(fNamespaces, tables, fGrammarCount);
        }
    }
    return fGlobalComponents[objectType];
}