src/share/jaxws_classes/com/sun/xml/internal/xsom/impl/parser/state/simpleType.java

Thu, 31 Aug 2017 15:18:52 +0800

author
aoqi
date
Thu, 31 Aug 2017 15:18:52 +0800
changeset 637
9c07ef4934dd
parent 397
b99d7e355d4b
parent 0
373ffda63c9a
child 1546
dc8316632248
permissions
-rw-r--r--

merge

     1 /*
     2  * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     8  * particular file as subject to the "Classpath" exception as provided
     9  * by Oracle in the LICENSE file that accompanied this code.
    10  *
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    14  * version 2 for more details (a copy is included in the LICENSE file that
    15  * accompanied this code).
    16  *
    17  * You should have received a copy of the GNU General Public License version
    18  * 2 along with this work; if not, write to the Free Software Foundation,
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    20  *
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    22  * or visit www.oracle.com if you need additional information or have any
    23  * questions.
    24  */
    26 /* this file is generated by RelaxNGCC */
    27 package com.sun.xml.internal.xsom.impl.parser.state;
    28 import org.xml.sax.SAXException;
    29 import org.xml.sax.XMLReader;
    30 import org.xml.sax.Attributes;
    31 import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
    33     import com.sun.xml.internal.xsom.*;
    34     import com.sun.xml.internal.xsom.parser.*;
    35     import com.sun.xml.internal.xsom.impl.*;
    36     import com.sun.xml.internal.xsom.impl.parser.*;
    37     import org.xml.sax.Locator;
    38     import org.xml.sax.ContentHandler;
    39     import org.xml.sax.helpers.*;
    40     import java.util.*;
    41     import java.math.BigInteger;
    45 class simpleType extends NGCCHandler {
    46     private AnnotationImpl annotation;
    47     private String name;
    48     private ForeignAttributesImpl fa;
    49     private String finalValue;
    50     protected final NGCCRuntimeEx $runtime;
    51     private int $_ngcc_current_state;
    52     protected String $uri;
    53     protected String $localName;
    54     protected String $qname;
    56     public final NGCCRuntime getRuntime() {
    57         return($runtime);
    58     }
    60     public simpleType(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
    61         super(source, parent, cookie);
    62         $runtime = runtime;
    63         $_ngcc_current_state = 19;
    64     }
    66     public simpleType(NGCCRuntimeEx runtime) {
    67         this(null, runtime, runtime, -1);
    68     }
    70     private void action0()throws SAXException {
    71         finalSet = makeFinalSet(finalValue);
    72 }
    74     private void action1()throws SAXException {
    75         locator=$runtime.copyLocator();
    76 }
    78     public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
    79         int $ai;
    80         $uri = $__uri;
    81         $localName = $__local;
    82         $qname = $__qname;
    83         switch($_ngcc_current_state) {
    84         case 15:
    85             {
    86                 if(($ai = $runtime.getAttributeIndex("","final"))>=0) {
    87                     $runtime.consumeAttribute($ai);
    88                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
    89                 }
    90                 else {
    91                     $_ngcc_current_state = 11;
    92                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
    93                 }
    94             }
    95             break;
    96         case 11:
    97             {
    98                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
    99                     $runtime.consumeAttribute($ai);
   100                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
   101                 }
   102                 else {
   103                     $_ngcc_current_state = 10;
   104                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
   105                 }
   106             }
   107             break;
   108         case 19:
   109             {
   110                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) {
   111                     $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
   112                     action1();
   113                     $_ngcc_current_state = 15;
   114                 }
   115                 else {
   116                     unexpectedEnterElement($__qname);
   117                 }
   118             }
   119             break;
   120         case 8:
   121             {
   122                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
   123                     NGCCHandler h = new annotation(this, super._source, $runtime, 89, null,AnnotationContext.SIMPLETYPE_DECL);
   124                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   125                 }
   126                 else {
   127                     $_ngcc_current_state = 7;
   128                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
   129                 }
   130             }
   131             break;
   132         case 10:
   133             {
   134                 if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("restriction")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("union")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("list")))))) {
   135                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 91, fa);
   136                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   137                 }
   138                 else {
   139                     unexpectedEnterElement($__qname);
   140                 }
   141             }
   142             break;
   143         case 7:
   144             {
   145                 action0();
   146                 $_ngcc_current_state = 2;
   147                 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
   148             }
   149             break;
   150         case 0:
   151             {
   152                 revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
   153             }
   154             break;
   155         case 2:
   156             {
   157                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("restriction"))) {
   158                     NGCCHandler h = new SimpleType_Restriction(this, super._source, $runtime, 85, annotation,locator,fa,name,finalSet);
   159                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   160                 }
   161                 else {
   162                     if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("list"))) {
   163                         NGCCHandler h = new SimpleType_List(this, super._source, $runtime, 86, annotation,locator,fa,name,finalSet);
   164                         spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   165                     }
   166                     else {
   167                         if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("union"))) {
   168                             NGCCHandler h = new SimpleType_Union(this, super._source, $runtime, 80, annotation,locator,fa,name,finalSet);
   169                             spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   170                         }
   171                         else {
   172                             unexpectedEnterElement($__qname);
   173                         }
   174                     }
   175                 }
   176             }
   177             break;
   178         default:
   179             {
   180                 unexpectedEnterElement($__qname);
   181             }
   182             break;
   183         }
   184     }
   186     public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
   187         int $ai;
   188         $uri = $__uri;
   189         $localName = $__local;
   190         $qname = $__qname;
   191         switch($_ngcc_current_state) {
   192         case 15:
   193             {
   194                 if(($ai = $runtime.getAttributeIndex("","final"))>=0) {
   195                     $runtime.consumeAttribute($ai);
   196                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   197                 }
   198                 else {
   199                     $_ngcc_current_state = 11;
   200                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   201                 }
   202             }
   203             break;
   204         case 11:
   205             {
   206                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
   207                     $runtime.consumeAttribute($ai);
   208                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   209                 }
   210                 else {
   211                     $_ngcc_current_state = 10;
   212                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   213                 }
   214             }
   215             break;
   216         case 8:
   217             {
   218                 $_ngcc_current_state = 7;
   219                 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   220             }
   221             break;
   222         case 7:
   223             {
   224                 action0();
   225                 $_ngcc_current_state = 2;
   226                 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   227             }
   228             break;
   229         case 1:
   230             {
   231                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) {
   232                     $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
   233                     $_ngcc_current_state = 0;
   234                 }
   235                 else {
   236                     unexpectedLeaveElement($__qname);
   237                 }
   238             }
   239             break;
   240         case 0:
   241             {
   242                 revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
   243             }
   244             break;
   245         default:
   246             {
   247                 unexpectedLeaveElement($__qname);
   248             }
   249             break;
   250         }
   251     }
   253     public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
   254         int $ai;
   255         $uri = $__uri;
   256         $localName = $__local;
   257         $qname = $__qname;
   258         switch($_ngcc_current_state) {
   259         case 15:
   260             {
   261                 if(($__uri.equals("") && $__local.equals("final"))) {
   262                     $_ngcc_current_state = 17;
   263                 }
   264                 else {
   265                     $_ngcc_current_state = 11;
   266                     $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
   267                 }
   268             }
   269             break;
   270         case 11:
   271             {
   272                 if(($__uri.equals("") && $__local.equals("name"))) {
   273                     $_ngcc_current_state = 13;
   274                 }
   275                 else {
   276                     $_ngcc_current_state = 10;
   277                     $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
   278                 }
   279             }
   280             break;
   281         case 8:
   282             {
   283                 $_ngcc_current_state = 7;
   284                 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
   285             }
   286             break;
   287         case 7:
   288             {
   289                 action0();
   290                 $_ngcc_current_state = 2;
   291                 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
   292             }
   293             break;
   294         case 0:
   295             {
   296                 revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
   297             }
   298             break;
   299         default:
   300             {
   301                 unexpectedEnterAttribute($__qname);
   302             }
   303             break;
   304         }
   305     }
   307     public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
   308         int $ai;
   309         $uri = $__uri;
   310         $localName = $__local;
   311         $qname = $__qname;
   312         switch($_ngcc_current_state) {
   313         case 15:
   314             {
   315                 $_ngcc_current_state = 11;
   316                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
   317             }
   318             break;
   319         case 11:
   320             {
   321                 $_ngcc_current_state = 10;
   322                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
   323             }
   324             break;
   325         case 8:
   326             {
   327                 $_ngcc_current_state = 7;
   328                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
   329             }
   330             break;
   331         case 7:
   332             {
   333                 action0();
   334                 $_ngcc_current_state = 2;
   335                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
   336             }
   337             break;
   338         case 12:
   339             {
   340                 if(($__uri.equals("") && $__local.equals("name"))) {
   341                     $_ngcc_current_state = 10;
   342                 }
   343                 else {
   344                     unexpectedLeaveAttribute($__qname);
   345                 }
   346             }
   347             break;
   348         case 16:
   349             {
   350                 if(($__uri.equals("") && $__local.equals("final"))) {
   351                     $_ngcc_current_state = 11;
   352                 }
   353                 else {
   354                     unexpectedLeaveAttribute($__qname);
   355                 }
   356             }
   357             break;
   358         case 0:
   359             {
   360                 revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
   361             }
   362             break;
   363         default:
   364             {
   365                 unexpectedLeaveAttribute($__qname);
   366             }
   367             break;
   368         }
   369     }
   371     public void text(String $value) throws SAXException {
   372         int $ai;
   373         switch($_ngcc_current_state) {
   374         case 13:
   375             {
   376                 name = $value;
   377                 $_ngcc_current_state = 12;
   378             }
   379             break;
   380         case 15:
   381             {
   382                 if(($ai = $runtime.getAttributeIndex("","final"))>=0) {
   383                     $runtime.consumeAttribute($ai);
   384                     $runtime.sendText(super._cookie, $value);
   385                 }
   386                 else {
   387                     $_ngcc_current_state = 11;
   388                     $runtime.sendText(super._cookie, $value);
   389                 }
   390             }
   391             break;
   392         case 11:
   393             {
   394                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
   395                     $runtime.consumeAttribute($ai);
   396                     $runtime.sendText(super._cookie, $value);
   397                 }
   398                 else {
   399                     $_ngcc_current_state = 10;
   400                     $runtime.sendText(super._cookie, $value);
   401                 }
   402             }
   403             break;
   404         case 8:
   405             {
   406                 $_ngcc_current_state = 7;
   407                 $runtime.sendText(super._cookie, $value);
   408             }
   409             break;
   410         case 7:
   411             {
   412                 action0();
   413                 $_ngcc_current_state = 2;
   414                 $runtime.sendText(super._cookie, $value);
   415             }
   416             break;
   417         case 17:
   418             {
   419                 finalValue = $value;
   420                 $_ngcc_current_state = 16;
   421             }
   422             break;
   423         case 0:
   424             {
   425                 revertToParentFromText(result, super._cookie, $value);
   426             }
   427             break;
   428         }
   429     }
   431     public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
   432         switch($__cookie__) {
   433         case 89:
   434             {
   435                 annotation = ((AnnotationImpl)$__result__);
   436                 $_ngcc_current_state = 7;
   437             }
   438             break;
   439         case 91:
   440             {
   441                 fa = ((ForeignAttributesImpl)$__result__);
   442                 $_ngcc_current_state = 8;
   443             }
   444             break;
   445         case 85:
   446             {
   447                 result = ((RestrictionSimpleTypeImpl)$__result__);
   448                 $_ngcc_current_state = 1;
   449             }
   450             break;
   451         case 86:
   452             {
   453                 result = ((ListSimpleTypeImpl)$__result__);
   454                 $_ngcc_current_state = 1;
   455             }
   456             break;
   457         case 80:
   458             {
   459                 result = ((UnionSimpleTypeImpl)$__result__);
   460                 $_ngcc_current_state = 1;
   461             }
   462             break;
   463         }
   464     }
   466     public boolean accepted() {
   467         return(($_ngcc_current_state == 0));
   468     }
   471                 /** computed simple type object */
   472                 private SimpleTypeImpl result;
   474                 private Locator locator;
   476       private Set finalSet;
   478       private Set makeFinalSet(String finalValue) {
   479         if(finalValue==null)
   480           return Collections.EMPTY_SET;
   482         Set s = new HashSet();
   483         StringTokenizer tokens = new StringTokenizer(finalValue);
   484         while(tokens.hasMoreTokens()) {
   485           String token = tokens.nextToken();
   486           if(token.equals("#all")) {
   487             s.add(XSVariety.ATOMIC);
   488             s.add(XSVariety.UNION);
   489             s.add(XSVariety.LIST);
   490           }
   491           if(token.equals("list")) {
   492             s.add(XSVariety.LIST);
   493           }
   494           if(token.equals("union")) {
   495             s.add(XSVariety.UNION);
   496           }
   497           if(token.equals("restriction")) {
   498             s.add(XSVariety.ATOMIC);
   499           }
   500         }
   501         return s;
   502       }
   504 }

mercurial