You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ne...@apache.org on 2001/10/18 18:11:37 UTC
cvs commit: xml-xerces/java/src/org/apache/xerces/impl/v2 CMBuilder.java XSCMLeaf.java XSDFACM.java XSWildcardDecl.java XSCMAny.java
neilg 01/10/18 09:11:37
Modified: java/src/org/apache/xerces/impl/v2 CMBuilder.java
XSCMLeaf.java XSDFACM.java XSWildcardDecl.java
Removed: java/src/org/apache/xerces/impl/v2 XSCMAny.java
Log:
implemented REVISIT relating to XSWildcardDecl not inheriting from XSElementDecl. This was originally done for performance reasons, but Henry Zongaro showed the performance gains were minimal; thus the design confusion brought about by this inheritance relationship was not justified.
Revision Changes Path
1.12 +2 -2 xml-xerces/java/src/org/apache/xerces/impl/v2/CMBuilder.java
Index: CMBuilder.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/v2/CMBuilder.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- CMBuilder.java 2001/10/16 19:29:56 1.11
+++ CMBuilder.java 2001/10/18 16:11:37 1.12
@@ -64,7 +64,7 @@
* This class constructs content models for a given grammar.
*
* @author Elena Litani, IBM
- * @version $Id: CMBuilder.java,v 1.11 2001/10/16 19:29:56 lmartin Exp $
+ * @version $Id: CMBuilder.java,v 1.12 2001/10/18 16:11:37 neilg Exp $
*/
public class CMBuilder {
@@ -507,7 +507,7 @@
// storing it. This makes the positions zero based since we
// store first and then increment.
//
- nodeRet = new XSCMLeaf((XSElementDecl)(startNode.fValue), fLeafCount++);
+ nodeRet = new XSCMLeaf(XSParticleDecl.PARTICLE_ELEMENT, (XSElementDecl)(startNode.fValue), fLeafCount++);
}
else {
//
1.2 +20 -7 xml-xerces/java/src/org/apache/xerces/impl/v2/XSCMLeaf.java
Index: XSCMLeaf.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/v2/XSCMLeaf.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- XSCMLeaf.java 2001/09/20 21:48:55 1.1
+++ XSCMLeaf.java 2001/10/18 16:11:37 1.2
@@ -74,7 +74,7 @@
//
/** This is the element that this leaf represents. */
- private XSElementDecl fElement = null;
+ private Object fElement = null;
/**
* Part of the algorithm to convert a regex directly to a DFA
@@ -88,8 +88,8 @@
//
/** Constructs a content model leaf. */
- public XSCMLeaf(XSElementDecl element, int position) {
- super(XSParticleDecl.PARTICLE_ELEMENT);
+ public XSCMLeaf(int type, Object element, int position) {
+ super(type);
// Store the element index and position
fElement = element;
@@ -108,8 +108,16 @@
// Package methods
//
+ // THIS METHOD ASSUMES THAT fElement IS AN XSElementDecl.
+ // If not, you'll get a ClassCastException...
final XSElementDecl getElement() {
- return fElement;
+ return (XSElementDecl)fElement;
+ }
+
+ // THIS METHOD ASSUMES THAT fElement IS AN XSWildcardDecl.
+ // If not, you'll get a ClassCastException...
+ final XSWildcardDecl getURI() {
+ return (XSWildcardDecl)fElement;
}
final int getPosition() {
@@ -134,9 +142,14 @@
public String toString() {
StringBuffer strRet = new StringBuffer(fElement.toString());
strRet.append(" (");
- strRet.append(fElement.fTargetNamespace);
- strRet.append(',');
- strRet.append(fElement.fName);
+ if(this.type() == XSParticleDecl.PARTICLE_ELEMENT) {
+ strRet.append(((XSElementDecl)fElement).fTargetNamespace);
+ strRet.append(',');
+ strRet.append(((XSElementDecl)fElement).fName);
+ } else {
+ strRet.append("##any:uri=");
+ strRet.append(((XSWildcardDecl)fElement).fNamespaceList[0]);
+ }
strRet.append(')');
if (fPosition >= 0) {
strRet.append
1.6 +6 -6 xml-xerces/java/src/org/apache/xerces/impl/v2/XSDFACM.java
Index: XSDFACM.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/v2/XSDFACM.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- XSDFACM.java 2001/10/17 21:46:09 1.5
+++ XSDFACM.java 2001/10/18 16:11:37 1.6
@@ -69,7 +69,7 @@
* it then uses in its validation algorithm.
*
* @author Neil Graham, IBM
- * @version $Id: XSDFACM.java,v 1.5 2001/10/17 21:46:09 sandygao Exp $
+ * @version $Id: XSDFACM.java,v 1.6 2001/10/18 16:11:37 neilg Exp $
*/
public class XSDFACM
implements XSCMValidator {
@@ -209,7 +209,7 @@
// temp variables
/** Temporary element declaration. */
- private XSElementDecl fElementDecl = new XSElementDecl();
+ private Object fElementDecl = new Object();
/** initializing static members **/
static {
@@ -497,8 +497,8 @@
*/
fElementDecl = new XSElementDecl();
- fElementDecl.fName = fEOCString;
- XSCMLeaf nodeEOC = new XSCMLeaf(fElementDecl);
+ ((XSElementDecl)fElementDecl).fName = fEOCString;
+ XSCMLeaf nodeEOC = new XSCMLeaf((XSElementDecl)fElementDecl);
fHeadNode = new XSCMBinOp(
XSParticleDecl.PARTICLE_SEQUENCE
, syntaxTree
@@ -997,9 +997,9 @@
// Recurse as required
if (nodeCur.type() == XSParticleDecl.PARTICLE_WILDCARD) {
// REVISIT: Don't waste these structures.
- fElementDecl = ((XSCMAny)nodeCur).getURI();
+ fElementDecl = (XSWildcardDecl)((XSCMLeaf)nodeCur).getURI();
// REVISIT: depends on result of XSDElement->XSDWildcard discussions...
- fLeafList[curIndex] = new XSCMLeaf(fElementDecl, ((XSCMAny)nodeCur).getPosition());
+ fLeafList[curIndex] = new XSCMLeaf(XSParticleDecl.PARTICLE_WILDCARD, fElementDecl, ((XSCMLeaf)nodeCur).getPosition());
fLeafListType[curIndex] = nodeCur.type();
curIndex++;
}
1.10 +2 -2 xml-xerces/java/src/org/apache/xerces/impl/v2/XSWildcardDecl.java
Index: XSWildcardDecl.java
===================================================================
RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/impl/v2/XSWildcardDecl.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- XSWildcardDecl.java 2001/10/17 23:07:14 1.9
+++ XSWildcardDecl.java 2001/10/18 16:11:37 1.10
@@ -67,9 +67,9 @@
* @author Sandy Gao, IBM
* @author Rahul Srivastava, Sun Microsystems Inc.
*
- * @version $Id: XSWildcardDecl.java,v 1.9 2001/10/17 23:07:14 sandygao Exp $
+ * @version $Id: XSWildcardDecl.java,v 1.10 2001/10/18 16:11:37 neilg Exp $
*/
-public class XSWildcardDecl extends XSElementDecl {
+public class XSWildcardDecl {
// types of wildcard
// namespace="##any"
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-cvs-help@xml.apache.org