< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/dtd/DTDGrammar.java

Print this page


   1 /*
   2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * @LastModified: Oct 2017
   4  */
   5 /*
   6  * Licensed to the Apache Software Foundation (ASF) under one or more
   7  * contributor license agreements.  See the NOTICE file distributed with
   8  * this work for additional information regarding copyright ownership.
   9  * The ASF licenses this file to You under the Apache License, Version 2.0
  10  * (the "License"); you may not use this file except in compliance with
  11  * the License.  You may obtain a copy of the License at
  12  *
  13  *      http://www.apache.org/licenses/LICENSE-2.0
  14  *
  15  * Unless required by applicable law or agreed to in writing, software
  16  * distributed under the License is distributed on an "AS IS" BASIS,
  17  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18  * See the License for the specific language governing permissions and
  19  * limitations under the License.
  20  */
  21 
  22 package com.sun.org.apache.xerces.internal.impl.dtd;
  23 


  46 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDContentModelSource;
  47 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource;
  48 import java.util.ArrayList;
  49 import java.util.HashMap;
  50 import java.util.List;
  51 import java.util.Map;
  52 import java.util.Random;
  53 
  54 /**
  55  * A DTD grammar. This class implements the XNI handler interfaces
  56  * for DTD information so that it can build the appropriate validation
  57  * structures automatically from the callbacks.
  58  *
  59  * @xerces.internal
  60  *
  61  * @author Eric Ye, IBM
  62  * @author Jeffrey Rodriguez, IBM
  63  * @author Andy Clark, IBM
  64  * @author Neil Graham, IBM
  65  *

  66  */
  67 public class DTDGrammar
  68     implements XMLDTDHandler, XMLDTDContentModelHandler, EntityState, Grammar {
  69 
  70     //
  71     // Constants
  72     //
  73 
  74     /** Top level scope (-1). */
  75     public static final int TOP_LEVEL_SCOPE = -1;
  76 
  77     // private
  78 
  79     /** Chunk shift (8). */
  80     private static final int CHUNK_SHIFT = 8; // 2^8 = 256
  81 
  82     /** Chunk size (1 << CHUNK_SHIFT). */
  83     private static final int CHUNK_SIZE = (1 << CHUNK_SHIFT);
  84 
  85     /** Chunk mask (CHUNK_SIZE - 1). */


   1 /*
   2  * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.

   3  */
   4 /*
   5  * Licensed to the Apache Software Foundation (ASF) under one or more
   6  * contributor license agreements.  See the NOTICE file distributed with
   7  * this work for additional information regarding copyright ownership.
   8  * The ASF licenses this file to You under the Apache License, Version 2.0
   9  * (the "License"); you may not use this file except in compliance with
  10  * the License.  You may obtain a copy of the License at
  11  *
  12  *      http://www.apache.org/licenses/LICENSE-2.0
  13  *
  14  * Unless required by applicable law or agreed to in writing, software
  15  * distributed under the License is distributed on an "AS IS" BASIS,
  16  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  17  * See the License for the specific language governing permissions and
  18  * limitations under the License.
  19  */
  20 
  21 package com.sun.org.apache.xerces.internal.impl.dtd;
  22 


  45 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDContentModelSource;
  46 import com.sun.org.apache.xerces.internal.xni.parser.XMLDTDSource;
  47 import java.util.ArrayList;
  48 import java.util.HashMap;
  49 import java.util.List;
  50 import java.util.Map;
  51 import java.util.Random;
  52 
  53 /**
  54  * A DTD grammar. This class implements the XNI handler interfaces
  55  * for DTD information so that it can build the appropriate validation
  56  * structures automatically from the callbacks.
  57  *
  58  * @xerces.internal
  59  *
  60  * @author Eric Ye, IBM
  61  * @author Jeffrey Rodriguez, IBM
  62  * @author Andy Clark, IBM
  63  * @author Neil Graham, IBM
  64  *
  65  * @LastModified: Oct 2017
  66  */
  67 public class DTDGrammar
  68     implements XMLDTDHandler, XMLDTDContentModelHandler, EntityState, Grammar {
  69 
  70     //
  71     // Constants
  72     //
  73 
  74     /** Top level scope (-1). */
  75     public static final int TOP_LEVEL_SCOPE = -1;
  76 
  77     // private
  78 
  79     /** Chunk shift (8). */
  80     private static final int CHUNK_SHIFT = 8; // 2^8 = 256
  81 
  82     /** Chunk size (1 << CHUNK_SHIFT). */
  83     private static final int CHUNK_SIZE = (1 << CHUNK_SHIFT);
  84 
  85     /** Chunk mask (CHUNK_SIZE - 1). */


< prev index next >