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