You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by el...@apache.org on 2001/08/28 18:34:58 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/impl/v2 SchemaGrammar.java

elena       01/08/28 09:34:58

  Modified:    java/src/org/apache/xerces/impl/v2 SchemaGrammar.java
  Log:
  Added some fields.
  
  Revision  Changes    Path
  1.2       +162 -2    xml-xerces/java/src/org/apache/xerces/impl/v2/SchemaGrammar.java
  
  Index: SchemaGrammar.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/v2/SchemaGrammar.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SchemaGrammar.java	2001/08/27 15:21:36	1.1
  +++ SchemaGrammar.java	2001/08/28 16:34:58	1.2
  @@ -57,8 +57,168 @@
   
   package org.apache.xerces.impl.v2;
   
  +
  +import org.apache.xerces.util.SymbolTable;
  +import org.apache.xerces.impl.v1.datatype.DatatypeValidator;
  +import org.apache.xerces.xni.QName;
  +import org.apache.xerces.impl.validation.ContentModelValidator;
  +
  +
  +import java.lang.Integer;
  +import java.util.Hashtable;
  +import java.util.Vector;
   /**
  - * @version $Id: SchemaGrammar.java,v 1.1 2001/08/27 15:21:36 sandygao Exp $
  + * @version $Id: SchemaGrammar.java,v 1.2 2001/08/28 16:34:58 elena Exp $
    */
  -class SchemaGrammar {
  +public class SchemaGrammar {
  +
  +    /** Chunk shift (8). */
  +    private static final int CHUNK_SHIFT = 8; // 2^8 = 256
  +
  +    /** Chunk size (1 << CHUNK_SHIFT). */
  +    private static final int CHUNK_SIZE = 1 << CHUNK_SHIFT;
  +
  +    /** Chunk mask (CHUNK_SIZE - 1). */
  +    private static final int CHUNK_MASK = CHUNK_SIZE - 1;
  +
  +    /** Initial chunk count (). */
  +    private static final int INITIAL_CHUNK_COUNT = (1 << (10 - CHUNK_SHIFT)); // 2^10 = 1k
  +
  +    /** Symbol table. */
  +    private SymbolTable fSymbolTable;
  +
  +    /** Target namespace of grammar. */
  +    private String fTargetNamespace;
  +
  +    // element, attribute, notation decl count
  +    private int fElementDeclCount = 0;
  +    private int fAttributeDeclCount = 0 ;
  +    private int fNotationCount = 0;
  +
  +    // content spec count
  +    private int fContentSpecCount = 0;
  +
  +
  +    /** Element declaration name. */
  +    private QName fElementDeclName[][] = new QName[INITIAL_CHUNK_COUNT][];
  +
  +    /** 
  +     * Element declaration default value. This value is used when
  +     * the element is of simple type.
  +     */
  +    private String fElementDeclDefaultValue[][] = new String[INITIAL_CHUNK_COUNT][];
  +
  +    /** 
  +     * Element declaration default type. This value is used when
  +     * the element is of simple type.
  +     */
  +    private short   fElementDeclDefaultType[][] = new short[INITIAL_CHUNK_COUNT][];
  +
  +    /** 
  +     * Element declaration datatype validator. This value is used when
  +     * the element is of simple type. 
  +     */
  +
  +    //REVISIT: should DatatypeValidator implement XSType
  +    private DatatypeValidator fElementDeclDatatypeValidator[][] = new DatatypeValidator[INITIAL_CHUNK_COUNT][];
  +
  +    /** 
  +     * Element declaration content spec index. This index value is used
  +     * to refer to the content spec information tables.
  +     */
  +    private int fElementDeclContentSpecIndex[][] = new int[INITIAL_CHUNK_COUNT][];
  +    private String fElementDeclSubGroupAffFullName[][] = new String[INITIAL_CHUNK_COUNT][];
  +    private Vector fElementDeclSubGroupQNames[][] = new Vector[INITIAL_CHUNK_COUNT][];
  +    private Vector fElementDeclAllSubGroupQNamesBlock[][] = new Vector[INITIAL_CHUNK_COUNT][];
  +    private Vector fElementDeclAllSubGroupQNames[][] = new Vector[INITIAL_CHUNK_COUNT][];
  +    private int fElementDeclBlockSet[][] = new int[INITIAL_CHUNK_COUNT][];
  +    private int fElementDeclFinalSet[][] = new int[INITIAL_CHUNK_COUNT][];
  +    private int fElementDeclMiscFlags[][] = new int[INITIAL_CHUNK_COUNT][];
  +
  +    /** 
  +     * Element declaration content model validator. This validator is
  +     * constructed from the content spec nodes.
  +     */
  +    private ContentModelValidator fElementDeclContentModelValidator[][] = new ContentModelValidator[INITIAL_CHUNK_COUNT][];
  +
  +    // attribute declarations
  +
  +    /** Attribute declaration name. */
  +    private QName fAttributeDeclName[][] = new QName[INITIAL_CHUNK_COUNT][];
  +
  +    /** 
  +     * Attribute declaration type.
  +     * @see XSAttributeDecl
  +     */
  +    private short fAttributeDeclType[][] = new short[INITIAL_CHUNK_COUNT][];
  +    private short fAttributeDeclDefaultType[][] = new short[INITIAL_CHUNK_COUNT][];
  +    private String fAttributeDeclDefaultValue[][] = new String[INITIAL_CHUNK_COUNT][];
  +    private int fAttributeDeclNextAttributeDeclIndex[][] = new int[INITIAL_CHUNK_COUNT][];
  +    //REVISIT: should DatatypeValidator implement XSType
  +    private DatatypeValidator fAttributeDeclDatatypeValidator[][] = new DatatypeValidator[INITIAL_CHUNK_COUNT][];
  +
  +    // content specs
  +
  +    // here saves the content spec binary trees for element decls, 
  +    // each element with a content model will hold a pointer which is 
  +    // the index of the head node of the content spec tree. 
  +
  +    private short fContentSpecType[][] = new short[INITIAL_CHUNK_COUNT][];
  +    private Object fContentSpecValue[][] = new Object[INITIAL_CHUNK_COUNT][];
  +    private Object fContentSpecOtherValue[][] = new Object[INITIAL_CHUNK_COUNT][];
  +
  +    // additional content spec tables
  +    // used if deferContentSpecExansion is enabled
  +    private int fContentSpecMinOccurs[][] = new int[INITIAL_CHUNK_COUNT][];
  +    private int fContentSpecMaxOccurs[][] = new int[INITIAL_CHUNK_COUNT][];
  +    // store the original uri
  +    private int fContentSpecOrgUri[][] = new int[INITIAL_CHUNK_COUNT][];
  +
  +    // notations
  +
  +    private String fNotationName[][] = new String[INITIAL_CHUNK_COUNT][];
  +    private String[][] fNotationPublicId = new String[INITIAL_CHUNK_COUNT][];
  +    private String[][] fNotationSystemId = new String[INITIAL_CHUNK_COUNT][];
  +
  +
  +    // REVISIT:
  +    // complex type declarations
  +    // add attributes to complex type decls
  +
  +    private Hashtable fComplexTypeRegistry = null;
  +    // REVISIT:
  +    // simple type declarations
  +    //
  +
  +    // other information
  +
  +    // global decls
  +    Hashtable topLevelGroupDecls = new Hashtable();
  +    Hashtable topLevelNotationDecls = new Hashtable();
  +    Hashtable topLevelAttrDecls  = new Hashtable();
  +    Hashtable topLevelAttrGrpDecls = new Hashtable();
  +    Hashtable topLevelElemDecls = new Hashtable();
  +    Hashtable topLevelTypeDecls = new Hashtable();
  +
  +    // UPA checking
  +
  +    // Set if we defer min/max expansion for content trees.   This is required if we
  +    // are doing particle derivation checking for schema.
  +    private boolean deferContentSpecExpansion = false;
  +
  +    // Set if we check Unique Particle Attribution
  +    // This one onle takes effect when deferContentSpecExpansion is set
  +    private boolean checkUniqueParticleAttribution = false;
  +    private boolean checkingUPA = false;
  +
  +    //
  +    // Constructors
  +    //
  +
  +    /** Default constructor. */
  +    public SchemaGrammar(SymbolTable symbolTable) {
  +        fSymbolTable = symbolTable;
  +    } // <init>(SymbolTable)
  +
  +
   } // class SchemaGrammar
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org