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