You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by an...@locus.apache.org on 2000/06/16 01:45:17 UTC

cvs commit: xml-xerces/java/src/org/apache/xerces/validators/common CMAny.java DFAContentModel.java Grammar.java Makefile CMAll.java

andyc       00/06/15 16:45:17

  Modified:    java/src/org/apache/xerces/validators/common
                        DFAContentModel.java Grammar.java Makefile
  Added:       java/src/org/apache/xerces/validators/common CMAny.java
  Removed:     java/src/org/apache/xerces/validators/common CMAll.java
  Log:
  The CMAll class should have been called CMAny. Oops! Also, it needed
  to be added to the Makefile.
  
  Revision  Changes    Path
  1.5       +3 -3      xml-xerces/java/src/org/apache/xerces/validators/common/DFAContentModel.java
  
  Index: DFAContentModel.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/common/DFAContentModel.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- DFAContentModel.java	2000/06/15 22:04:17	1.4
  +++ DFAContentModel.java	2000/06/15 23:45:16	1.5
  @@ -74,7 +74,7 @@
    * are very constrained in form and easily handled via a special case. 
    * This also makes implementation of this class much easier.
    *
  - * @version $Id: DFAContentModel.java,v 1.4 2000/06/15 22:04:17 andyc Exp $
  + * @version $Id: DFAContentModel.java,v 1.5 2000/06/15 23:45:16 andyc Exp $
    */
   public class DFAContentModel 
       implements XMLContentModel {
  @@ -1053,8 +1053,8 @@
               nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL ||
               nodeCur.type() == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER) {
               // REVISIT: Don't waste these structures.
  -            QName qname = new QName(-1, -1, -1, ((CMAll)nodeCur).getURI());
  -            fLeafList[curIndex] = new CMLeaf(qname, ((CMAll)nodeCur).getPosition());
  +            QName qname = new QName(-1, -1, -1, ((CMAny)nodeCur).getURI());
  +            fLeafList[curIndex] = new CMLeaf(qname, ((CMAny)nodeCur).getPosition());
               fLeafListType[curIndex] = nodeCur.type();
               curIndex++;
           }
  
  
  
  1.5       +4 -4      xml-xerces/java/src/org/apache/xerces/validators/common/Grammar.java
  
  Index: Grammar.java
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/common/Grammar.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Grammar.java	2000/06/15 22:04:17	1.4
  +++ Grammar.java	2000/06/15 23:45:16	1.5
  @@ -69,7 +69,7 @@
   
   
   /**
  - * @version $Id: Grammar.java,v 1.4 2000/06/15 22:04:17 andyc Exp $
  + * @version $Id: Grammar.java,v 1.5 2000/06/15 23:45:16 andyc Exp $
    */
   public class Grammar
   implements XMLContentSpec.Provider {
  @@ -646,13 +646,13 @@
           CMNode nodeRet = null;
           getContentSpec(startNode, contentSpec);
           if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ANY) {
  -            nodeRet = new CMAll(contentSpec.type, -1, fLeafCount++);
  +            nodeRet = new CMAny(contentSpec.type, -1, fLeafCount++);
           }
           else if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ANY_OTHER) {
  -            nodeRet = new CMAll(contentSpec.type, contentSpec.otherValue, fLeafCount++);
  +            nodeRet = new CMAny(contentSpec.type, contentSpec.otherValue, fLeafCount++);
           }
           else if (contentSpec.type == XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL) {
  -            nodeRet = new CMAll(contentSpec.type, -1, fLeafCount++);
  +            nodeRet = new CMAny(contentSpec.type, -1, fLeafCount++);
           }
           //
           //  If this node is a leaf, then its an easy one. We just add it
  
  
  
  1.4       +1 -0      xml-xerces/java/src/org/apache/xerces/validators/common/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /home/cvs/xml-xerces/java/src/org/apache/xerces/validators/common/Makefile,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Makefile	2000/05/17 18:33:04	1.3
  +++ Makefile	2000/06/15 23:45:16	1.4
  @@ -1,4 +1,5 @@
   TARGETS=\
  +	CMAny.class\
   	CMBinOp.class\
   	CMException.class\
   	CMLeaf.class\
  
  
  
  1.1                  xml-xerces/java/src/org/apache/xerces/validators/common/CMAny.java
  
  Index: CMAny.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 2000 The Apache Software Foundation.  All rights 
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer. 
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:  
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Xerces" and "Apache Software Foundation" must
   *    not be used to endorse or promote products derived from this
   *    software without prior written permission. For written 
   *    permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    nor may "Apache" appear in their name, without prior written
   *    permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation and was
   * originally based on software copyright (c) 1999, International
   * Business Machines, Inc., http://www.apache.org.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  
  package org.apache.xerces.validators.common;
  
  import org.apache.xerces.framework.XMLContentSpec;
  import org.apache.xerces.utils.ImplementationMessages;
  import org.apache.xerces.utils.QName;
  import org.apache.xerces.utils.StringPool;
  
  /**
   * Content model any node.
   *
   * @version $Id: CMAny.java,v 1.1 2000/06/15 23:45:16 andyc Exp $
   */
  public class CMAny
      extends CMNode {
  
      //
      // Data
      //
  
      /** 
       * The any content model type. This value is one of the following:
       * XMLContentSpec.CONTENTSPECNODE_ANY, 
       * XMLContentSpec.CONTENTSPECNODE_ANY_OTHER,
       * XMLContentSpec.CONTENTSPECNODE_ANY_LOCAL.
       */
      private int fType;
  
      /**
       * URI of the any content model. This value is set if the type is
       * of the following:
       * XMLContentSpec.CONTENTSPECNODE_ANY, 
       * XMLContentSpec.CONTENTSPECNODE_ANY_OTHER.
       */
      private int fURI;
  
      /**
       * Part of the algorithm to convert a regex directly to a DFA
       * numbers each leaf sequentially. If its -1, that means its an
       * epsilon node. Zero and greater are non-epsilon positions.
       */
      private int fPosition = -1;
  
      //
      // Constructors
      //
  
      /** Constructs a content model any. */
      public CMAny(int type, int uri, int position) throws CMException {
          super(type);
  
          // Store the information
          fType = type;
          fURI = uri;
          fPosition = position;
      }
  
      //
      // Package methods
      //
  
      final int getType() {
          return fType;
      }
  
      final int getURI() {
          return fURI;
      }
  
      final int getPosition()
      {
          return fPosition;
      }
  
      final void setPosition(int newPosition)
      {
          fPosition = newPosition;
      }
  
      //
      // CMNode methods
      //
  
      // package
  
      boolean isNullable() throws CMException
      {
          // Leaf nodes are never nullable unless its an epsilon node
          return (fPosition == -1);
      }
  
      String toString(StringPool stringPool)
      {
          StringBuffer strRet = new StringBuffer();
          strRet.append("(");
          strRet.append("##any:uri=");
          strRet.append(stringPool.toString(fURI));
          strRet.append(')');
          if (fPosition >= 0)
          {
              strRet.append
              (
                  " (Pos:"
                  + new Integer(fPosition).toString()
                  + ")"
              );
          }
          return strRet.toString();
      }
  
      // protected
  
      protected void calcFirstPos(CMStateSet toSet) throws CMException
      {
          // If we are an epsilon node, then the first pos is an empty set
          if (fPosition == -1)
              toSet.zeroBits();
  
          // Otherwise, its just the one bit of our position
          else
              toSet.setBit(fPosition);
      }
  
      protected void calcLastPos(CMStateSet toSet) throws CMException
      {
          // If we are an epsilon node, then the last pos is an empty set
          if (fPosition == -1)
              toSet.zeroBits();
  
          // Otherwise, its just the one bit of our position
          else
              toSet.setBit(fPosition);
      }
  
  } // class CMAny