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 10:
  99             {
 100                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
 101                     $runtime.consumeAttribute($ai);
 102                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 103                 }
 104                 else {
 105                     unexpectedEnterElement($__qname);
 106                 }
 107             }
 108             break;
 109         case 5:
 110             {
 111                 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")))) {
 112                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 357, null);
 113                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
 114                 }
 115                 else {
 116                     unexpectedEnterElement($__qname);
 117                 }
 118             }
 119             break;
 120         case 11:
 121             {
 122                 if(($ai = $runtime.getAttributeIndex("","ID"))>=0) {
 123                     $runtime.consumeAttribute($ai);
 124                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 125                 }
 126                 else {
 127                     $_ngcc_current_state = 10;
 128                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 129                 }
 130             }
 131             break;
 132         case 6:
 133             {
 134                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
 135                     NGCCHandler h = new annotation(this, super._source, $runtime, 359, null,AnnotationContext.MODELGROUP_DECL);
 136                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
 137                 }
 138                 else {
 139                     $_ngcc_current_state = 5;
 140                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 141                 }
 142             }
 143             break;
 144         case 0:
 145             {
 146                 revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
 147             }
 148             break;
 149         case 4:
 150             {
 151                 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")))) {
 152                     $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
 153                     $_ngcc_current_state = 3;
 154                 }
 155                 else {
 156                     unexpectedEnterElement($__qname);
 157                 }
 158             }
 159             break;
 160         case 15:
 161             {
 162                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group"))) {
 163                     $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
 164                     action2();
 165                     $_ngcc_current_state = 11;
 166                 }
 167                 else {
 168                     unexpectedEnterElement($__qname);
 169                 }
 170             }
 171             break;
 172         case 3:
 173             {
 174                 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")))))))) {
 175                     NGCCHandler h = new modelGroupBody(this, super._source, $runtime, 355, mloc,compositorName);
 176                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
 177                 }
 178                 else {
 179                     unexpectedEnterElement($__qname);
 180                 }
 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 10:
 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 11:
 209             {
 210                 if(($ai = $runtime.getAttributeIndex("","ID"))>=0) {
 211                     $runtime.consumeAttribute($ai);
 212                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 213                 }
 214                 else {
 215                     $_ngcc_current_state = 10;
 216                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 217                 }
 218             }
 219             break;
 220         case 1:
 221             {
 222                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("group"))) {
 223                     $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
 224                     $_ngcc_current_state = 0;
 225                     action0();
 226                 }
 227                 else {
 228                     unexpectedLeaveElement($__qname);
 229                 }
 230             }
 231             break;
 232         case 6:
 233             {
 234                 $_ngcc_current_state = 5;
 235                 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 236             }
 237             break;
 238         case 0:
 239             {
 240                 revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
 241             }
 242             break;
 243         case 2:
 244             {
 245                 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")))) {
 246                     $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
 247                     $_ngcc_current_state = 1;
 248                 }
 249                 else {
 250                     unexpectedLeaveElement($__qname);
 251                 }
 252             }
 253             break;
 254         case 3:
 255             {
 256                 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")))) {
 257                     NGCCHandler h = new modelGroupBody(this, super._source, $runtime, 355, mloc,compositorName);
 258                     spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
 259                 }
 260                 else {
 261                     unexpectedLeaveElement($__qname);
 262                 }
 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 10:
 280             {
 281                 if(($__uri.equals("") && $__local.equals("name"))) {
 282                     $_ngcc_current_state = 9;
 283                 }
 284                 else {
 285                     unexpectedEnterAttribute($__qname);
 286                 }
 287             }
 288             break;
 289         case 11:
 290             {
 291                 if(($__uri.equals("") && $__local.equals("ID"))) {
 292                     $_ngcc_current_state = 13;
 293                 }
 294                 else {
 295                     $_ngcc_current_state = 10;
 296                     $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__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 11:
 326             {
 327                 $_ngcc_current_state = 10;
 328                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
 329             }
 330             break;
 331         case 6:
 332             {
 333                 $_ngcc_current_state = 5;
 334                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
 335             }
 336             break;
 337         case 0:
 338             {
 339                 revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
 340             }
 341             break;
 342         case 12:
 343             {
 344                 if(($__uri.equals("") && $__local.equals("ID"))) {
 345                     $_ngcc_current_state = 10;
 346                 }
 347                 else {
 348                     unexpectedLeaveAttribute($__qname);
 349                 }
 350             }
 351             break;
 352         case 8:
 353             {
 354                 if(($__uri.equals("") && $__local.equals("name"))) {
 355                     $_ngcc_current_state = 6;
 356                 }
 357                 else {
 358                     unexpectedLeaveAttribute($__qname);
 359                 }
 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 10:
 374             {
 375                 if(($ai = $runtime.getAttributeIndex("","name"))>=0) {
 376                     $runtime.consumeAttribute($ai);
 377                     $runtime.sendText(super._cookie, $value);
 378                 }
 379             }
 380             break;
 381         case 11:
 382             {
 383                 if(($ai = $runtime.getAttributeIndex("","ID"))>=0) {
 384                     $runtime.consumeAttribute($ai);
 385                     $runtime.sendText(super._cookie, $value);
 386                 }
 387                 else {
 388                     $_ngcc_current_state = 10;
 389                     $runtime.sendText(super._cookie, $value);
 390                 }
 391             }
 392             break;
 393         case 6:
 394             {
 395                 $_ngcc_current_state = 5;
 396                 $runtime.sendText(super._cookie, $value);
 397             }
 398             break;
 399         case 0:
 400             {
 401                 revertToParentFromText(result, super._cookie, $value);
 402             }
 403             break;
 404         case 9:
 405             {
 406                 name = $value;
 407                 $_ngcc_current_state = 8;
 408             }
 409             break;
 410         case 13:
 411             {
 412                 $_ngcc_current_state = 12;
 413             }
 414             break;
 415         }
 416     }
 417 
 418     public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
 419         switch($__cookie__) {
 420         case 357:
 421             {
 422                 fa = ((ForeignAttributesImpl)$__result__);
 423                 action1();
 424                 $_ngcc_current_state = 4;
 425             }
 426             break;
 427         case 359:
 428             {
 429                 annotation = ((AnnotationImpl)$__result__);
 430                 $_ngcc_current_state = 5;
 431             }
 432             break;
 433         case 355:
 434             {
 435                 term = ((ModelGroupImpl)$__result__);
 436                 $_ngcc_current_state = 2;
 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 }