You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by je...@locus.apache.org on 2000/10/06 18:26:26 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl/validation Grammar.java XMLAttributeDecl.java XMLEntityDecl.java XMLNotationDecl.java XMLSimpleType.java
jeffreyr 00/10/06 09:26:25
Modified: java/src/org/apache/xerces/impl/validation Tag: xerces_j_2
Grammar.java XMLAttributeDecl.java
XMLEntityDecl.java XMLNotationDecl.java
XMLSimpleType.java
Log:
Adding grammar methods
Revision Changes Path
No revision
No revision
1.1.2.3 +226 -1 xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/Grammar.java
Index: Grammar.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/Grammar.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- Grammar.java 2000/10/02 00:40:07 1.1.2.2
+++ Grammar.java 2000/10/06 16:26:20 1.1.2.3
@@ -63,7 +63,7 @@
* @author Stubs generated by DesignDoc on Wed Jun 07 11:58:44 PDT 2000
* @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
*
- * @version $Id: Grammar.java,v 1.1.2.2 2000/10/02 00:40:07 lehors Exp $
+ * @version $Id: Grammar.java,v 1.1.2.3 2000/10/06 16:26:20 jeffreyr Exp $
*/
public class Grammar {
@@ -377,5 +377,230 @@
public boolean getNotationDecl(int notationDeclIndex, XMLNotationDecl notationDecl) {
throw new RuntimeException("implement Grammar#getNotationDecl(int,XMLNotationDecl):boolean");
} // getNotationDecl
+
+
+ //
+ // Protected methods
+ //
+
+
+ protected int createElementDecl() {
+ int chunk = fElementDeclCount >> CHUNK_SHIFT;
+ int index = fElementDeclCount & CHUNK_MASK;
+ ensureElementDeclCapacity(chunk);
+ fElementDeclName[chunk][index] = null;
+ fElementDeclType[chunk][index] = -1;
+ fElementDeclDatatypeValidator[chunk][index] = null;
+ fElementDeclContentModelValidator[chunk][index] = null;
+ fElementDeclFirstAttributeDeclIndex[chunk][index] = -1;
+ fElementDeclLastAttributeDeclIndex[chunk][index] = -1;
+ fElementDeclDefaultValue[chunk][index] = null;
+ fElementDeclDefaultType[chunk][index] = -1;
+ return fElementDeclCount++;
+ }
+
+ protected void setElementDecl(int elementDeclIndex, XMLElementDecl elementDecl) {
+
+ }
+
+ protected void putElementNameMapping(QName name, int scope,
+ int elementDeclIndex) {
+ }
+
+ protected void setFirstAttributeDeclIndex(int elementDeclIndex, int newFirstAttrIndex){
+
+ if (elementDeclIndex < 0 || elementDeclIndex >= fElementDeclCount) {
+ return;
+ }
+
+ int chunk = elementDeclIndex >> CHUNK_SHIFT;
+ int index = elementDeclIndex & CHUNK_MASK;
+
+ fElementDeclFirstAttributeDeclIndex[chunk][index] = newFirstAttrIndex;
+ }
+
+
+ protected int createAttributeDecl() {
+ int chunk = fAttributeDeclCount >> CHUNK_SHIFT;
+ int index = fAttributeDeclCount & CHUNK_MASK;
+
+ ensureAttributeDeclCapacity(chunk);
+ fAttributeDeclName[chunk][index] = new QName();
+ fAttributeDeclType[chunk][index] = -1;
+ fAttributeDeclDatatypeValidator[chunk][index] = null;
+ fAttributeDeclEnumeration[chunk][index] = null;
+ fAttributeDeclDefaultType[chunk][index] = XMLSimpleType.DEFAULT_TYPE_IMPLIED;
+ fAttributeDeclDefaultValue[chunk][index] = null;
+ fAttributeDeclNextAttributeDeclIndex[chunk][index] = -1;
+ return fAttributeDeclCount++;
+ }
+
+
+ //protected void setAttributeDecl(int elementDeclIndex, int attributeDeclIndex, XMLAttributeDecl attributeDecl) {
+ //}
+
+ protected boolean isDTD() {
+ return false;
+ }
+
+ // debugging
+
+ public void printElements( ) {
+ int elementDeclIndex = 0;
+ XMLElementDecl elementDecl = new XMLElementDecl();
+ while (getElementDecl(elementDeclIndex++, elementDecl)) {
+ System.out.println("element decl: "+elementDecl.name+
+ ", "+ elementDecl.name.rawname+
+ ", "+ elementDecl.contentModelValidator.toString());
+
+ }
+ }
+
+ public void printAttributes(int elementDeclIndex) {
+ int attributeDeclIndex = getFirstAttributeDeclIndex(elementDeclIndex);
+ System.out.print(elementDeclIndex);
+ System.out.print(" [");
+ while (attributeDeclIndex != -1) {
+ System.out.print(' ');
+ System.out.print(attributeDeclIndex);
+ printAttribute(attributeDeclIndex);
+ attributeDeclIndex = getNextAttributeDeclIndex(attributeDeclIndex);
+ if (attributeDeclIndex != -1) {
+ System.out.print(",");
+ }
+ }
+ System.out.println(" ]");
+ }
+
+
+ //
+ // Private methods
+ //
+
+ // debugging
+
+ private void printAttribute(int attributeDeclIndex) {
+ XMLAttributeDecl attributeDecl = new XMLAttributeDecl();
+ if (getAttributeDecl(attributeDeclIndex, attributeDecl)) {
+ System.out.print(" { ");
+ System.out.print(attributeDecl.name.localpart);
+ System.out.print(" }");
+ }
+ }
+
+ // content models
+ //
+
+ //private void printSyntaxTree(CMNode cmn){
+ //}
+
+
+ // private int countLeaves(int contentSpecIndex) {
+ // return countLeaves(contentSpecIndex, new XMLContentSpec());
+ //}
+
+ //private int countLeaves(int contentSpecIndex, XMLContentSpec contentSpec) {
+ //}
+ // ensure capacity
+
+
+ private boolean ensureElementDeclCapacity(int chunk) {
+ try {
+ return fElementDeclName[chunk][0] == null;
+ } catch (ArrayIndexOutOfBoundsException ex) {
+ fElementDeclName = resize(fElementDeclName, fElementDeclName.length * 2);
+ fElementDeclType = resize(fElementDeclType, fElementDeclType.length * 2);
+ fElementDeclDatatypeValidator = resize(fElementDeclDatatypeValidator, fElementDeclDatatypeValidator.length * 2);
+ fElementDeclContentModelValidator = resize(fElementDeclContentModelValidator, fElementDeclContentModelValidator.length * 2);
+ fElementDeclFirstAttributeDeclIndex = resize(fElementDeclFirstAttributeDeclIndex, fElementDeclFirstAttributeDeclIndex.length * 2);
+ fElementDeclLastAttributeDeclIndex = resize(fElementDeclLastAttributeDeclIndex, fElementDeclLastAttributeDeclIndex.length * 2);
+ fElementDeclDefaultValue = resize( fElementDeclDefaultValue, fElementDeclDefaultValue.length * 2 );
+ fElementDeclDefaultType = resize( fElementDeclDefaultType, fElementDeclDefaultType.length *2 );
+ } catch (NullPointerException ex) {
+ // ignore
+ }
+ fElementDeclName[chunk] = new String[CHUNK_SIZE];
+ fElementDeclType[chunk] = new short[CHUNK_SIZE];
+ fElementDeclDatatypeValidator[chunk] = new DatatypeValidator[CHUNK_SIZE];
+ fElementDeclContentModelValidator[chunk] = new ContentModelValidator[CHUNK_SIZE];
+ fElementDeclFirstAttributeDeclIndex[chunk] = new int[CHUNK_SIZE];
+ fElementDeclLastAttributeDeclIndex[chunk] = new int[CHUNK_SIZE];
+ fElementDeclDefaultValue[chunk] = new String[CHUNK_SIZE];
+ fElementDeclDefaultType[chunk] = new short[CHUNK_SIZE];
+ return true;
+ }
+
+
+
+ private boolean ensureAttributeDeclCapacity(int chunk) {
+ try {
+ return fAttributeDeclName[chunk][0] == null;
+ } catch (ArrayIndexOutOfBoundsException ex) {
+ fAttributeDeclName = resize(fAttributeDeclName, fAttributeDeclName.length * 2);
+ fAttributeDeclType = resize(fAttributeDeclType, fAttributeDeclType.length * 2);
+ fAttributeDeclEnumeration = resize(fAttributeDeclEnumeration, fAttributeDeclEnumeration.length * 2);
+ fAttributeDeclDefaultType = resize(fAttributeDeclDefaultType, fAttributeDeclDefaultType.length * 2);
+ fAttributeDeclDatatypeValidator = resize(fAttributeDeclDatatypeValidator, fAttributeDeclDatatypeValidator.length * 2);
+ fAttributeDeclDefaultValue = resize(fAttributeDeclDefaultValue, fAttributeDeclDefaultValue.length * 2);
+ fAttributeDeclNextAttributeDeclIndex = resize(fAttributeDeclNextAttributeDeclIndex, fAttributeDeclNextAttributeDeclIndex.length * 2);
+ } catch (NullPointerException ex) {
+ // ignore
+ }
+ fAttributeDeclName[chunk] = new QName[CHUNK_SIZE];
+ fAttributeDeclType[chunk] = new short[CHUNK_SIZE];
+ fAttributeDeclEnumeration[chunk] = new String[CHUNK_SIZE][];
+ fAttributeDeclDefaultType[chunk] = new short[CHUNK_SIZE];
+ fAttributeDeclDatatypeValidator[chunk] = new DatatypeValidator[CHUNK_SIZE];
+ fAttributeDeclDefaultValue[chunk] = new String[CHUNK_SIZE];
+ fAttributeDeclNextAttributeDeclIndex[chunk] = new int[CHUNK_SIZE];
+ return true;
+ }
+
+ // resize initial chunk
+
+ private short[][] resize(short array[][], int newsize) {
+ short newarray[][] = new short[newsize][];
+ System.arraycopy(array, 0, newarray, 0, array.length);
+ return newarray;
+ }
+
+
+ private int[][] resize(int array[][], int newsize) {
+ int newarray[][] = new int[newsize][];
+ System.arraycopy(array, 0, newarray, 0, array.length);
+ return newarray;
+ }
+
+ private DatatypeValidator[][] resize(DatatypeValidator array[][], int newsize) {
+ DatatypeValidator newarray[][] = new DatatypeValidator[newsize][];
+ System.arraycopy(array, 0, newarray, 0, array.length);
+ return newarray;
+ }
+
+ private ContentModelValidator[][] resize(ContentModelValidator array[][], int newsize) {
+ ContentModelValidator newarray[][] = new ContentModelValidator[newsize][];
+ System.arraycopy(array, 0, newarray, 0, array.length);
+ return newarray;
+ }
+
+
+ private QName[][] resize(QName array[][], int newsize) {
+ QName newarray[][] = new QName[newsize][];
+ System.arraycopy(array, 0, newarray, 0, array.length);
+ return newarray;
+ }
+
+ private String[][] resize(String array[][], int newsize) {
+ String newarray[][] = new String[newsize][];
+ System.arraycopy(array, 0, newarray, 0, array.length);
+ return newarray;
+ }
+
+ private String[][][] resize(String array[][][], int newsize) {
+ String newarray[][][] = new String[newsize] [][];
+ System.arraycopy(array, 0, newarray, 0, array.length);
+ return newarray;
+ }
+
} // class Grammar
1.1.2.3 +7 -1 xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/XMLAttributeDecl.java
Index: XMLAttributeDecl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/XMLAttributeDecl.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- XMLAttributeDecl.java 2000/10/02 00:40:07 1.1.2.2
+++ XMLAttributeDecl.java 2000/10/06 16:26:21 1.1.2.3
@@ -61,7 +61,7 @@
/**
* @author Stubs generated by DesignDoc on Wed Jun 07 11:58:44 PDT 2000
- * @version $Id: XMLAttributeDecl.java,v 1.1.2.2 2000/10/02 00:40:07 lehors Exp $
+ * @version $Id: XMLAttributeDecl.java,v 1.1.2.3 2000/10/06 16:26:21 jeffreyr Exp $
*/
public class XMLAttributeDecl {
@@ -90,12 +90,18 @@
* @param optional
*/
public void setValues(QName name, XMLSimpleType simpleType, boolean optional) {
+ this.name = name;
+ this.simpleType = simpleType;
+ this.optional = optional;
} // setValues
/**
* clear
*/
public void clear() {
+ this.name = null;
+ this.simpleType = null;
+ this.optional = false;
} // clear
} // class XMLAttributeDecl
1.1.2.3 +14 -1 xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/XMLEntityDecl.java
Index: XMLEntityDecl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/XMLEntityDecl.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- XMLEntityDecl.java 2000/10/02 00:40:08 1.1.2.2
+++ XMLEntityDecl.java 2000/10/06 16:26:21 1.1.2.3
@@ -59,7 +59,7 @@
/**
* @author Stubs generated by DesignDoc on Mon Sep 11 11:10:57 PDT 2000
- * @version $Id: XMLEntityDecl.java,v 1.1.2.2 2000/10/02 00:40:08 lehors Exp $
+ * @version $Id: XMLEntityDecl.java,v 1.1.2.3 2000/10/06 16:26:21 jeffreyr Exp $
*/
public class XMLEntityDecl {
@@ -100,12 +100,25 @@
* @param isPE
*/
public void setValues(String name, String publicId, String systemId, String baseSystemId, String notation, boolean isPE) {
+ this.name = name;
+ this.publicId = publicId;
+ this.systemId = systemId;
+ this.baseSystemId = baseSystemId;
+ this.notation = notation;
+ this.isPE = isPE;
} // setValues
/**
* clear
*/
public void clear() {
+ this.name = null;
+ this.publicId = null;
+ this.systemId = null;
+ this.baseSystemId = null;
+ this.notation = null;
+ this.isPE = false;
+
} // clear
} // class XMLEntityDecl
1.1.2.3 +7 -1 xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/XMLNotationDecl.java
Index: XMLNotationDecl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/XMLNotationDecl.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- XMLNotationDecl.java 2000/10/02 00:40:08 1.1.2.2
+++ XMLNotationDecl.java 2000/10/06 16:26:22 1.1.2.3
@@ -59,7 +59,7 @@
/**
* @author Stubs generated by DesignDoc on Wed Jun 07 11:58:44 PDT 2000
- * @version $Id: XMLNotationDecl.java,v 1.1.2.2 2000/10/02 00:40:08 lehors Exp $
+ * @version $Id: XMLNotationDecl.java,v 1.1.2.3 2000/10/06 16:26:22 jeffreyr Exp $
*/
public class XMLNotationDecl {
@@ -88,12 +88,18 @@
* @param systemId
*/
public void setValues(String name, String publicId, String systemId) {
+ this.name = name;
+ this.publicId = publicId;
+ this.systemId = systemId;
} // setValues
/**
* clear
*/
public void clear() {
+ this.name = null;
+ this.publicId = null;
+ this.systemId = null;
} // clear
} // class XMLNotationDecl
1.1.2.3 +15 -9 xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/XMLSimpleType.java
Index: XMLSimpleType.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/validation/Attic/XMLSimpleType.java,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -r1.1.2.2 -r1.1.2.3
--- XMLSimpleType.java 2000/10/02 00:40:08 1.1.2.2
+++ XMLSimpleType.java 2000/10/06 16:26:22 1.1.2.3
@@ -59,7 +59,7 @@
/**
* @author Stubs generated by DesignDoc on Wed Jun 07 11:58:44 PDT 2000
- * @version $Id: XMLSimpleType.java,v 1.1.2.2 2000/10/02 00:40:08 lehors Exp $
+ * @version $Id: XMLSimpleType.java,v 1.1.2.3 2000/10/06 16:26:22 jeffreyr Exp $
*/
public class XMLSimpleType {
@@ -68,28 +68,28 @@
//
/** TYPE_CDATA */
- public static final short TYPE_CDATA = -1;
+ public static final short TYPE_CDATA = 1;
/** TYPE_ENTITY */
- public static final short TYPE_ENTITY = -1;
+ public static final short TYPE_ENTITY = 2;
/** TYPE_ENUMERATION */
- public static final short TYPE_ENUMERATION = -1;
+ public static final short TYPE_ENUMERATION = 3;
/** TYPE_ID */
- public static final short TYPE_ID = -1;
+ public static final short TYPE_ID = 4;
/** TYPE_IDREF */
- public static final short TYPE_IDREF = -1;
+ public static final short TYPE_IDREF = 5;
/** TYPE_NMTOKEN */
- public static final short TYPE_NMTOKEN = -1;
+ public static final short TYPE_NMTOKEN = 6;
/** TYPE_NOTATION */
- public static final short TYPE_NOTATION = -1;
+ public static final short TYPE_NOTATION = 7;
/** TYPE_NAMED */
- public static final short TYPE_NAMED = -1;
+ public static final short TYPE_NAMED = 8;
/** DEFAULT_TYPE_DEFAULT */
public static final short DEFAULT_TYPE_DEFAULT = -1;
@@ -144,12 +144,18 @@
* @param datatypeValidator
*/
public void setValues(short type, String name, String[] enumeration, boolean list, short defaultType, String defaultValue, DatatypeValidator datatypeValidator) {
+ this.type = type;
+ this.name = name;
+ this.enumeration = enumeration;
} // setValues
/**
* clear
*/
public void clear() {
+ this.type = -1;
+ this.name = null;
+ this.enumeration = null;
} // clear
} // class XMLSimpleType