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

Mon, 28 May 2018 10:36:45 +0800

author
aoqi
date
Mon, 28 May 2018 10:36:45 +0800
changeset 1546
dc8316632248
parent 1445
06086cb6c349
parent 637
9c07ef4934dd
permissions
-rw-r--r--

Merge

     1 /*
     2  * Copyright (c) 1997, 2017, 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;
    29 import com.sun.xml.internal.bind.WhiteSpaceProcessor;
    30 import com.sun.xml.internal.xsom.*;
    31 import com.sun.xml.internal.xsom.impl.*;
    32 import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
    33 import com.sun.xml.internal.xsom.parser.*;
    35 import java.util.Collections;
    36 import java.util.HashSet;
    37 import java.util.Set;
    38 import java.util.StringTokenizer;
    40 import org.xml.sax.Attributes;
    41 import org.xml.sax.Locator;
    42 import org.xml.sax.SAXException;
    44 class simpleType extends NGCCHandler {
    45     private AnnotationImpl annotation;
    46     private String name;
    47     private ForeignAttributesImpl fa;
    48     private String finalValue;
    49     protected final NGCCRuntimeEx $runtime;
    50     private int $_ngcc_current_state;
    51     protected String $uri;
    52     protected String $localName;
    53     protected String $qname;
    55     public final NGCCRuntime getRuntime() {
    56         return($runtime);
    57     }
    59     public simpleType(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
    60         super(source, parent, cookie);
    61         $runtime = runtime;
    62         $_ngcc_current_state = 19;
    63     }
    65     public simpleType(NGCCRuntimeEx runtime) {
    66         this(null, runtime, runtime, -1);
    67     }
    69     private void action0()throws SAXException {
    70         finalSet = makeFinalSet(finalValue);
    71 }
    73     private void action1()throws SAXException {
    74         locator=$runtime.copyLocator();
    75 }
    77     public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
    78         int $ai;
    79         $uri = $__uri;
    80         $localName = $__local;
    81         $qname = $__qname;
    82         switch($_ngcc_current_state) {
    83         case 15:
    84             {
    85                 if(($ai = $runtime.getAttributeIndex("","final"))>=0) {
    86                     $runtime.consumeAttribute($ai);
    87                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
    88                 }
    89                 else {
    90                     $_ngcc_current_state = 11;
    91                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
    92                 }
    93             }
    94             break;
    95         case 11:
    96             {
    97                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
    98                     $runtime.consumeAttribute($ai);
    99                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
   100                 }
   101                 else {
   102                     $_ngcc_current_state = 10;
   103                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
   104                 }
   105             }
   106             break;
   107         case 19:
   108             {
   109                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) {
   110                     $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
   111                     action1();
   112                     $_ngcc_current_state = 15;
   113                 }
   114                 else {
   115                     unexpectedEnterElement($__qname);
   116                 }
   117             }
   118             break;
   119         case 8:
   120             {
   121                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
   122                     NGCCHandler h = new annotation(this, super._source, $runtime, 89, null,AnnotationContext.SIMPLETYPE_DECL);
   123                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   124                 }
   125                 else {
   126                     $_ngcc_current_state = 7;
   127                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
   128                 }
   129             }
   130             break;
   131         case 10:
   132             {
   133                 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")))))) {
   134                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 91, fa);
   135                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   136                 }
   137                 else {
   138                     unexpectedEnterElement($__qname);
   139                 }
   140             }
   141             break;
   142         case 7:
   143             {
   144                 action0();
   145                 $_ngcc_current_state = 2;
   146                 $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
   147             }
   148             break;
   149         case 0:
   150             {
   151                 revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
   152             }
   153             break;
   154         case 2:
   155             {
   156                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("restriction"))) {
   157                     NGCCHandler h = new SimpleType_Restriction(this, super._source, $runtime, 85, annotation,locator,fa,name,finalSet);
   158                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   159                 }
   160                 else {
   161                     if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("list"))) {
   162                         NGCCHandler h = new SimpleType_List(this, super._source, $runtime, 86, annotation,locator,fa,name,finalSet);
   163                         spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   164                     }
   165                     else {
   166                         if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("union"))) {
   167                             NGCCHandler h = new SimpleType_Union(this, super._source, $runtime, 80, annotation,locator,fa,name,finalSet);
   168                             spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
   169                         }
   170                         else {
   171                             unexpectedEnterElement($__qname);
   172                         }
   173                     }
   174                 }
   175             }
   176             break;
   177         default:
   178             {
   179                 unexpectedEnterElement($__qname);
   180             }
   181             break;
   182         }
   183     }
   185     public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
   186         int $ai;
   187         $uri = $__uri;
   188         $localName = $__local;
   189         $qname = $__qname;
   190         switch($_ngcc_current_state) {
   191         case 15:
   192             {
   193                 if(($ai = $runtime.getAttributeIndex("","final"))>=0) {
   194                     $runtime.consumeAttribute($ai);
   195                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   196                 }
   197                 else {
   198                     $_ngcc_current_state = 11;
   199                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   200                 }
   201             }
   202             break;
   203         case 11:
   204             {
   205                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
   206                     $runtime.consumeAttribute($ai);
   207                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   208                 }
   209                 else {
   210                     $_ngcc_current_state = 10;
   211                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   212                 }
   213             }
   214             break;
   215         case 8:
   216             {
   217                 $_ngcc_current_state = 7;
   218                 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   219             }
   220             break;
   221         case 7:
   222             {
   223                 action0();
   224                 $_ngcc_current_state = 2;
   225                 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
   226             }
   227             break;
   228         case 1:
   229             {
   230                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) {
   231                     $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
   232                     $_ngcc_current_state = 0;
   233                 }
   234                 else {
   235                     unexpectedLeaveElement($__qname);
   236                 }
   237             }
   238             break;
   239         case 0:
   240             {
   241                 revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
   242             }
   243             break;
   244         default:
   245             {
   246                 unexpectedLeaveElement($__qname);
   247             }
   248             break;
   249         }
   250     }
   252     public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
   253         int $ai;
   254         $uri = $__uri;
   255         $localName = $__local;
   256         $qname = $__qname;
   257         switch($_ngcc_current_state) {
   258         case 15:
   259             {
   260                 if(($__uri.equals("") && $__local.equals("final"))) {
   261                     $_ngcc_current_state = 17;
   262                 }
   263                 else {
   264                     $_ngcc_current_state = 11;
   265                     $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
   266                 }
   267             }
   268             break;
   269         case 11:
   270             {
   271                 if(($__uri.equals("") && $__local.equals("name"))) {
   272                     $_ngcc_current_state = 13;
   273                 }
   274                 else {
   275                     $_ngcc_current_state = 10;
   276                     $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
   277                 }
   278             }
   279             break;
   280         case 8:
   281             {
   282                 $_ngcc_current_state = 7;
   283                 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
   284             }
   285             break;
   286         case 7:
   287             {
   288                 action0();
   289                 $_ngcc_current_state = 2;
   290                 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
   291             }
   292             break;
   293         case 0:
   294             {
   295                 revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
   296             }
   297             break;
   298         default:
   299             {
   300                 unexpectedEnterAttribute($__qname);
   301             }
   302             break;
   303         }
   304     }
   306     public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
   307         int $ai;
   308         $uri = $__uri;
   309         $localName = $__local;
   310         $qname = $__qname;
   311         switch($_ngcc_current_state) {
   312         case 15:
   313             {
   314                 $_ngcc_current_state = 11;
   315                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
   316             }
   317             break;
   318         case 11:
   319             {
   320                 $_ngcc_current_state = 10;
   321                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
   322             }
   323             break;
   324         case 8:
   325             {
   326                 $_ngcc_current_state = 7;
   327                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
   328             }
   329             break;
   330         case 7:
   331             {
   332                 action0();
   333                 $_ngcc_current_state = 2;
   334                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
   335             }
   336             break;
   337         case 12:
   338             {
   339                 if(($__uri.equals("") && $__local.equals("name"))) {
   340                     $_ngcc_current_state = 10;
   341                 }
   342                 else {
   343                     unexpectedLeaveAttribute($__qname);
   344                 }
   345             }
   346             break;
   347         case 16:
   348             {
   349                 if(($__uri.equals("") && $__local.equals("final"))) {
   350                     $_ngcc_current_state = 11;
   351                 }
   352                 else {
   353                     unexpectedLeaveAttribute($__qname);
   354                 }
   355             }
   356             break;
   357         case 0:
   358             {
   359                 revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
   360             }
   361             break;
   362         default:
   363             {
   364                 unexpectedLeaveAttribute($__qname);
   365             }
   366             break;
   367         }
   368     }
   370     public void text(String $value) throws SAXException {
   371         int $ai;
   372         switch($_ngcc_current_state) {
   373         case 13:
   374             {
   375                 name = WhiteSpaceProcessor.collapse($value);
   376                 $_ngcc_current_state = 12;
   377             }
   378             break;
   379         case 15:
   380             {
   381                 if(($ai = $runtime.getAttributeIndex("","final"))>=0) {
   382                     $runtime.consumeAttribute($ai);
   383                     $runtime.sendText(super._cookie, $value);
   384                 }
   385                 else {
   386                     $_ngcc_current_state = 11;
   387                     $runtime.sendText(super._cookie, $value);
   388                 }
   389             }
   390             break;
   391         case 11:
   392             {
   393                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
   394                     $runtime.consumeAttribute($ai);
   395                     $runtime.sendText(super._cookie, $value);
   396                 }
   397                 else {
   398                     $_ngcc_current_state = 10;
   399                     $runtime.sendText(super._cookie, $value);
   400                 }
   401             }
   402             break;
   403         case 8:
   404             {
   405                 $_ngcc_current_state = 7;
   406                 $runtime.sendText(super._cookie, $value);
   407             }
   408             break;
   409         case 7:
   410             {
   411                 action0();
   412                 $_ngcc_current_state = 2;
   413                 $runtime.sendText(super._cookie, $value);
   414             }
   415             break;
   416         case 17:
   417             {
   418                 finalValue = $value;
   419                 $_ngcc_current_state = 16;
   420             }
   421             break;
   422         case 0:
   423             {
   424                 revertToParentFromText(result, super._cookie, $value);
   425             }
   426             break;
   427         }
   428     }
   430     public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
   431         switch($__cookie__) {
   432         case 89:
   433             {
   434                 annotation = ((AnnotationImpl)$__result__);
   435                 $_ngcc_current_state = 7;
   436             }
   437             break;
   438         case 91:
   439             {
   440                 fa = ((ForeignAttributesImpl)$__result__);
   441                 $_ngcc_current_state = 8;
   442             }
   443             break;
   444         case 85:
   445             {
   446                 result = ((RestrictionSimpleTypeImpl)$__result__);
   447                 $_ngcc_current_state = 1;
   448             }
   449             break;
   450         case 86:
   451             {
   452                 result = ((ListSimpleTypeImpl)$__result__);
   453                 $_ngcc_current_state = 1;
   454             }
   455             break;
   456         case 80:
   457             {
   458                 result = ((UnionSimpleTypeImpl)$__result__);
   459                 $_ngcc_current_state = 1;
   460             }
   461             break;
   462         }
   463     }
   465     public boolean accepted() {
   466         return(($_ngcc_current_state == 0));
   467     }
   470                 /** computed simple type object */
   471                 private SimpleTypeImpl result;
   473                 private Locator locator;
   475       private Set finalSet;
   477       private Set makeFinalSet(String finalValue) {
   478         if(finalValue==null)
   479           return Collections.EMPTY_SET;
   481         Set s = new HashSet();
   482         StringTokenizer tokens = new StringTokenizer(finalValue);
   483         while(tokens.hasMoreTokens()) {
   484           String token = tokens.nextToken();
   485           if(token.equals("#all")) {
   486             s.add(XSVariety.ATOMIC);
   487             s.add(XSVariety.UNION);
   488             s.add(XSVariety.LIST);
   489           }
   490           if(token.equals("list")) {
   491             s.add(XSVariety.LIST);
   492           }
   493           if(token.equals("union")) {
   494             s.add(XSVariety.UNION);
   495           }
   496           if(token.equals("restriction")) {
   497             s.add(XSVariety.ATOMIC);
   498           }
   499         }
   500         return s;
   501       }
   503 }

mercurial