src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/DTDGrammar.java
changeset 47359 e1a6c0168741
parent 47216 71c04702a3d5
child 48409 5ab69533994b
equal deleted inserted replaced
47358:d07d5f7cab35 47359:e1a6c0168741
     1 /*
     1 /*
     2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
       
     3  * @LastModified: Oct 2017
     3  */
     4  */
     4 /*
     5 /*
     5  * Licensed to the Apache Software Foundation (ASF) under one or more
     6  * Licensed to the Apache Software Foundation (ASF) under one or more
     6  * contributor license agreements.  See the NOTICE file distributed with
     7  * contributor license agreements.  See the NOTICE file distributed with
     7  * this work for additional information regarding copyright ownership.
     8  * this work for additional information regarding copyright ownership.
    44 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription;
    45 import com.sun.org.apache.xerces.internal.xni.grammars.XMLGrammarDescription;
    45 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDContentModelSource;
    46 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDContentModelSource;
    46 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource;
    47 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource;
    47 import java.util.ArrayList;
    48 import java.util.ArrayList;
    48 import java.util.HashMap;
    49 import java.util.HashMap;
       
    50 import java.util.List;
    49 import java.util.Map;
    51 import java.util.Map;
    50 import java.util.Random;
    52 import java.util.Random;
    51 
    53 
    52 /**
    54 /**
    53  * A DTD grammar. This class implements the XNI handler interfaces
    55  * A DTD grammar. This class implements the XNI handler interfaces
   796         if (fGrammarDescription.getRootName() == null) {
   798         if (fGrammarDescription.getRootName() == null) {
   797             // we don't know what the root is; so use possibleRoots...
   799             // we don't know what the root is; so use possibleRoots...
   798             int chunk, index = 0;
   800             int chunk, index = 0;
   799             String currName = null;
   801             String currName = null;
   800             final int size = fElementDeclCount;
   802             final int size = fElementDeclCount;
   801             ArrayList elements = new ArrayList(size);
   803             List<String> elements = new ArrayList<>(size);
   802             for (int i = 0; i < size; ++i) {
   804             for (int i = 0; i < size; ++i) {
   803                 chunk = i >> CHUNK_SHIFT;
   805                 chunk = i >> CHUNK_SHIFT;
   804                 index = i & CHUNK_MASK;
   806                 index = i & CHUNK_MASK;
   805                 currName = fElementDeclName[chunk][index].rawname;
   807                 currName = fElementDeclName[chunk][index].rawname;
   806                 elements.add(currName);
   808                 elements.add(currName);