1 /*
   2  * Copyright (c) 1997, 2016, 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  */
  25 
  26 /* this file is generated by RelaxNGCC */
  27 package com.sun.xml.internal.xsom.impl.parser.state;
  28 
  29 import com.sun.xml.internal.xsom.impl.*;
  30 import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
  31 import com.sun.xml.internal.xsom.parser.*;
  32 
  33 import org.xml.sax.Attributes;
  34 import org.xml.sax.Locator;
  35 import org.xml.sax.SAXException;
  36 
  37 
  38 
  39 class group extends NGCCHandler {
  40     private AnnotationImpl annotation;
  41     private String name;
  42     private ModelGroupImpl term;
  43     private ForeignAttributesImpl fa;
  44     protected final NGCCRuntimeEx $runtime;
  45     private int $_ngcc_current_state;
  46     protected String $uri;
  47     protected String $localName;
  48     protected String $qname;
  49 
  50     public final NGCCRuntime getRuntime() {
  51         return($runtime);
  52     }
  53 
  54     public group(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
  55         super(source, parent, cookie);
  56         $runtime = runtime;
  57         $_ngcc_current_state = 15;
  58     }
  59 
  60     public group(NGCCRuntimeEx runtime) {
  61         this(null, runtime, runtime, -1);
  62     }
  63 
  64     private void action0()throws SAXException {
  65 
  66         result = new ModelGroupDeclImpl( $runtime.document,
  67                 annotation, loc, fa,
  68                 $runtime.currentSchema.getTargetNamespace(),
  69                                 name,
  70                                 term
  71                         );
  72 
  73 }
  74 
  75     private void action1()throws SAXException {
  76 
  77         mloc = $runtime.copyLocator();
  78         compositorName = $localName;
  79 
  80 }
  81 
  82     private void action2()throws SAXException {
  83         loc = $runtime.copyLocator();
  84 }
  85 
  86     public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
  87         int $ai;
  88         $uri = $__uri;
  89         $localName = $__local;
  90         $qname = $__qname;
  91         switch($_ngcc_current_state) {
  92         case 10:
  93             {
  94                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
  95                     $runtime.consumeAttribute($ai);
  96                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
  97                 }
  98                 else {
  99                     unexpectedEnterElement($__qname);
 100                 }
 101             }
 102             break;
 103         case 5:
 104             {
 105                 if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))) {
 106                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 357, null);
 107                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
 108                 }
 109                 else {
 110                     unexpectedEnterElement($__qname);
 111                 }
 112             }
 113             break;
 114         case 11:
 115             {
 116                 if(($ai = $runtime.getAttributeIndex("","ID"))>=0) {
 117                     $runtime.consumeAttribute($ai);
 118                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 119                 }
 120                 else {
 121                     $_ngcc_current_state = 10;
 122                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 123                 }
 124             }
 125             break;
 126         case 6:
 127             {
 128                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
 129                     NGCCHandler h = new annotation(this, super._source, $runtime, 359, null,AnnotationContext.MODELGROUP_DECL);
 130                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
 131                 }
 132                 else {
 133                     $_ngcc_current_state = 5;
 134                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 135                 }
 136             }
 137             break;
 138         case 0:
 139             {
 140                 revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
 141             }
 142             break;
 143         case 4:
 144             {
 145                 if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))) {
 146                     $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
 147                     $_ngcc_current_state = 3;
 148                 }
 149                 else {
 150                     unexpectedEnterElement($__qname);
 151                 }
 152             }
 153             break;
 154         case 15:
 155             {
 156                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group"))) {
 157                     $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
 158                     action2();
 159                     $_ngcc_current_state = 11;
 160                 }
 161                 else {
 162                     unexpectedEnterElement($__qname);
 163                 }
 164             }
 165             break;
 166         case 3:
 167             {
 168                 if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("element")) || (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("any")) || ((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))))))) {
 169                     NGCCHandler h = new modelGroupBody(this, super._source, $runtime, 355, mloc,compositorName);
 170                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
 171                 }
 172                 else {
 173                     unexpectedEnterElement($__qname);
 174                 }
 175             }
 176             break;
 177         default:
 178             {
 179                 unexpectedEnterElement($__qname);
 180             }
 181             break;
 182         }
 183     }
 184 
 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 10:
 192             {
 193                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
 194                     $runtime.consumeAttribute($ai);
 195                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 196                 }
 197                 else {
 198                     unexpectedLeaveElement($__qname);
 199                 }
 200             }
 201             break;
 202         case 11:
 203             {
 204                 if(($ai = $runtime.getAttributeIndex("","ID"))>=0) {
 205                     $runtime.consumeAttribute($ai);
 206                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 207                 }
 208                 else {
 209                     $_ngcc_current_state = 10;
 210                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 211                 }
 212             }
 213             break;
 214         case 1:
 215             {
 216                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group"))) {
 217                     $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
 218                     $_ngcc_current_state = 0;
 219                     action0();
 220                 }
 221                 else {
 222                     unexpectedLeaveElement($__qname);
 223                 }
 224             }
 225             break;
 226         case 6:
 227             {
 228                 $_ngcc_current_state = 5;
 229                 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 230             }
 231             break;
 232         case 0:
 233             {
 234                 revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
 235             }
 236             break;
 237         case 2:
 238             {
 239                 if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))) {
 240                     $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
 241                     $_ngcc_current_state = 1;
 242                 }
 243                 else {
 244                     unexpectedLeaveElement($__qname);
 245                 }
 246             }
 247             break;
 248         case 3:
 249             {
 250                 if(((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence")))) {
 251                     NGCCHandler h = new modelGroupBody(this, super._source, $runtime, 355, mloc,compositorName);
 252                     spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
 253                 }
 254                 else {
 255                     unexpectedLeaveElement($__qname);
 256                 }
 257             }
 258             break;
 259         default:
 260             {
 261                 unexpectedLeaveElement($__qname);
 262             }
 263             break;
 264         }
 265     }
 266 
 267     public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
 268         int $ai;
 269         $uri = $__uri;
 270         $localName = $__local;
 271         $qname = $__qname;
 272         switch($_ngcc_current_state) {
 273         case 10:
 274             {
 275                 if(($__uri.equals("") && $__local.equals("name"))) {
 276                     $_ngcc_current_state = 9;
 277                 }
 278                 else {
 279                     unexpectedEnterAttribute($__qname);
 280                 }
 281             }
 282             break;
 283         case 11:
 284             {
 285                 if(($__uri.equals("") && $__local.equals("ID"))) {
 286                     $_ngcc_current_state = 13;
 287                 }
 288                 else {
 289                     $_ngcc_current_state = 10;
 290                     $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
 291                 }
 292             }
 293             break;
 294         case 6:
 295             {
 296                 $_ngcc_current_state = 5;
 297                 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
 298             }
 299             break;
 300         case 0:
 301             {
 302                 revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
 303             }
 304             break;
 305         default:
 306             {
 307                 unexpectedEnterAttribute($__qname);
 308             }
 309             break;
 310         }
 311     }
 312 
 313     public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
 314         int $ai;
 315         $uri = $__uri;
 316         $localName = $__local;
 317         $qname = $__qname;
 318         switch($_ngcc_current_state) {
 319         case 11:
 320             {
 321                 $_ngcc_current_state = 10;
 322                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
 323             }
 324             break;
 325         case 6:
 326             {
 327                 $_ngcc_current_state = 5;
 328                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
 329             }
 330             break;
 331         case 0:
 332             {
 333                 revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
 334             }
 335             break;
 336         case 12:
 337             {
 338                 if(($__uri.equals("") && $__local.equals("ID"))) {
 339                     $_ngcc_current_state = 10;
 340                 }
 341                 else {
 342                     unexpectedLeaveAttribute($__qname);
 343                 }
 344             }
 345             break;
 346         case 8:
 347             {
 348                 if(($__uri.equals("") && $__local.equals("name"))) {
 349                     $_ngcc_current_state = 6;
 350                 }
 351                 else {
 352                     unexpectedLeaveAttribute($__qname);
 353                 }
 354             }
 355             break;
 356         default:
 357             {
 358                 unexpectedLeaveAttribute($__qname);
 359             }
 360             break;
 361         }
 362     }
 363 
 364     public void text(String $value) throws SAXException {
 365         int $ai;
 366         switch($_ngcc_current_state) {
 367         case 10:
 368             {
 369                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
 370                     $runtime.consumeAttribute($ai);
 371                     $runtime.sendText(super._cookie, $value);
 372                 }
 373             }
 374             break;
 375         case 11:
 376             {
 377                 if(($ai = $runtime.getAttributeIndex("","ID"))>=0) {
 378                     $runtime.consumeAttribute($ai);
 379                     $runtime.sendText(super._cookie, $value);
 380                 }
 381                 else {
 382                     $_ngcc_current_state = 10;
 383                     $runtime.sendText(super._cookie, $value);
 384                 }
 385             }
 386             break;
 387         case 6:
 388             {
 389                 $_ngcc_current_state = 5;
 390                 $runtime.sendText(super._cookie, $value);
 391             }
 392             break;
 393         case 0:
 394             {
 395                 revertToParentFromText(result, super._cookie, $value);
 396             }
 397             break;
 398         case 9:
 399             {
 400                 name = $runtime.collapse($value);
 401                 $_ngcc_current_state = 8;
 402             }
 403             break;
 404         case 13:
 405             {
 406                 $_ngcc_current_state = 12;
 407             }
 408             break;
 409         }
 410     }
 411 
 412     public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
 413         switch($__cookie__) {
 414         case 357:
 415             {
 416                 fa = ((ForeignAttributesImpl)$__result__);
 417                 action1();
 418                 $_ngcc_current_state = 4;
 419             }
 420             break;
 421         case 359:
 422             {
 423                 annotation = ((AnnotationImpl)$__result__);
 424                 $_ngcc_current_state = 5;
 425             }
 426             break;
 427         case 355:
 428             {
 429                 term = ((ModelGroupImpl)$__result__);
 430                 $_ngcc_current_state = 2;
 431             }
 432             break;
 433         }
 434     }
 435 
 436     public boolean accepted() {
 437         return(($_ngcc_current_state == 0));
 438     }
 439 
 440 
 441                 private ModelGroupDeclImpl result;
 442                 private Locator loc,mloc;
 443                 private String compositorName;
 444 
 445 }