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 SimpleType_List extends NGCCHandler {
  46     private Locator locator;
  47     private AnnotationImpl annotation;
  48     private String name;
  49     private UName itemTypeName;
  50     private Set finalSet;
  51     private ForeignAttributesImpl fa;
  52     protected final NGCCRuntimeEx $runtime;
  53     private int $_ngcc_current_state;
  54     protected String $uri;
  55     protected String $localName;
  56     protected String $qname;
  57 
  58     public final NGCCRuntime getRuntime() {
  59         return($runtime);
  60     }
  61 
  62     public SimpleType_List(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, AnnotationImpl _annotation, Locator _locator, ForeignAttributesImpl _fa, String _name, Set _finalSet) {
  63         super(source, parent, cookie);
  64         $runtime = runtime;
  65         this.annotation = _annotation;
  66         this.locator = _locator;
  67         this.fa = _fa;
  68         this.name = _name;
  69         this.finalSet = _finalSet;
  70         $_ngcc_current_state = 10;
  71     }
  72 
  73     public SimpleType_List(NGCCRuntimeEx runtime, AnnotationImpl _annotation, Locator _locator, ForeignAttributesImpl _fa, String _name, Set _finalSet) {
  74         this(null, runtime, runtime, -1, _annotation, _locator, _fa, _name, _finalSet);
  75     }
  76 
  77     private void action0()throws SAXException {
  78 
  79         result = new ListSimpleTypeImpl(
  80                 $runtime.document, annotation, locator, fa,
  81                 name, name==null, finalSet, itemType );
  82 
  83 }
  84 
  85     private void action1()throws SAXException {
  86 
  87                 itemType = new DelayedRef.SimpleType(
  88                         $runtime, lloc, $runtime.currentSchema, itemTypeName);
  89 
  90 }
  91 
  92     private void action2()throws SAXException {
  93         lloc=$runtime.copyLocator();
  94 }
  95 
  96     public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
  97         int $ai;
  98         $uri = $__uri;
  99         $localName = $__local;
 100         $qname = $__qname;
 101         switch($_ngcc_current_state) {
 102         case 9:
 103             {
 104                 if((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")) || ((($ai = $runtime.getAttributeIndex("","itemType"))>=0 && (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation")))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))))) {
 105                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 266, fa);
 106                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
 107                 }
 108                 else {
 109                     unexpectedEnterElement($__qname);
 110                 }
 111             }
 112             break;
 113         case 7:
 114             {
 115                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
 116                     NGCCHandler h = new annotation(this, super._source, $runtime, 264, annotation,AnnotationContext.SIMPLETYPE_DECL);
 117                     spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
 118                 }
 119                 else {
 120                     $_ngcc_current_state = 2;
 121                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 122                 }
 123             }
 124             break;
 125         case 10:
 126             {
 127                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("list"))) {
 128                     $runtime.onEnterElementConsumed($__uri, $__local, $__qname, $attrs);
 129                     action2();
 130                     $_ngcc_current_state = 9;
 131                 }
 132                 else {
 133                     unexpectedEnterElement($__qname);
 134                 }
 135             }
 136             break;
 137         case 2:
 138             {
 139                 if(($ai = $runtime.getAttributeIndex("","itemType"))>=0) {
 140                     $runtime.consumeAttribute($ai);
 141                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 142                 }
 143                 else {
 144                     if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("simpleType"))) {
 145                         NGCCHandler h = new simpleType(this, super._source, $runtime, 258);
 146                         spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
 147                     }
 148                     else {
 149                         unexpectedEnterElement($__qname);
 150                     }
 151                 }
 152             }
 153             break;
 154         case 0:
 155             {
 156                 revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
 157             }
 158             break;
 159         default:
 160             {
 161                 unexpectedEnterElement($__qname);
 162             }
 163             break;
 164         }
 165     }
 166 
 167     public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
 168         int $ai;
 169         $uri = $__uri;
 170         $localName = $__local;
 171         $qname = $__qname;
 172         switch($_ngcc_current_state) {
 173         case 9:
 174             {
 175                 if((($ai = $runtime.getAttributeIndex("","itemType"))>=0 && ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("list")))) {
 176                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 266, fa);
 177                     spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
 178                 }
 179                 else {
 180                     unexpectedLeaveElement($__qname);
 181                 }
 182             }
 183             break;
 184         case 7:
 185             {
 186                 $_ngcc_current_state = 2;
 187                 $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 188             }
 189             break;
 190         case 2:
 191             {
 192                 if(($ai = $runtime.getAttributeIndex("","itemType"))>=0) {
 193                     $runtime.consumeAttribute($ai);
 194                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 195                 }
 196                 else {
 197                     unexpectedLeaveElement($__qname);
 198                 }
 199             }
 200             break;
 201         case 0:
 202             {
 203                 revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
 204             }
 205             break;
 206         case 1:
 207             {
 208                 if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("list"))) {
 209                     $runtime.onLeaveElementConsumed($__uri, $__local, $__qname);
 210                     $_ngcc_current_state = 0;
 211                     action0();
 212                 }
 213                 else {
 214                     unexpectedLeaveElement($__qname);
 215                 }
 216             }
 217             break;
 218         default:
 219             {
 220                 unexpectedLeaveElement($__qname);
 221             }
 222             break;
 223         }
 224     }
 225 
 226     public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
 227         int $ai;
 228         $uri = $__uri;
 229         $localName = $__local;
 230         $qname = $__qname;
 231         switch($_ngcc_current_state) {
 232         case 9:
 233             {
 234                 if(($__uri.equals("") && $__local.equals("itemType"))) {
 235                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 266, fa);
 236                     spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
 237                 }
 238                 else {
 239                     unexpectedEnterAttribute($__qname);
 240                 }
 241             }
 242             break;
 243         case 7:
 244             {
 245                 $_ngcc_current_state = 2;
 246                 $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
 247             }
 248             break;
 249         case 2:
 250             {
 251                 if(($__uri.equals("") && $__local.equals("itemType"))) {
 252                     $_ngcc_current_state = 5;
 253                 }
 254                 else {
 255                     unexpectedEnterAttribute($__qname);
 256                 }
 257             }
 258             break;
 259         case 0:
 260             {
 261                 revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
 262             }
 263             break;
 264         default:
 265             {
 266                 unexpectedEnterAttribute($__qname);
 267             }
 268             break;
 269         }
 270     }
 271 
 272     public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
 273         int $ai;
 274         $uri = $__uri;
 275         $localName = $__local;
 276         $qname = $__qname;
 277         switch($_ngcc_current_state) {
 278         case 7:
 279             {
 280                 $_ngcc_current_state = 2;
 281                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
 282             }
 283             break;
 284         case 0:
 285             {
 286                 revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
 287             }
 288             break;
 289         case 4:
 290             {
 291                 if(($__uri.equals("") && $__local.equals("itemType"))) {
 292                     $_ngcc_current_state = 1;
 293                 }
 294                 else {
 295                     unexpectedLeaveAttribute($__qname);
 296                 }
 297             }
 298             break;
 299         default:
 300             {
 301                 unexpectedLeaveAttribute($__qname);
 302             }
 303             break;
 304         }
 305     }
 306 
 307     public void text(String $value) throws SAXException {
 308         int $ai;
 309         switch($_ngcc_current_state) {
 310         case 9:
 311             {
 312                 if(($ai = $runtime.getAttributeIndex("","itemType"))>=0) {
 313                     NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 266, fa);
 314                     spawnChildFromText(h, $value);
 315                 }
 316             }
 317             break;
 318         case 7:
 319             {
 320                 $_ngcc_current_state = 2;
 321                 $runtime.sendText(super._cookie, $value);
 322             }
 323             break;
 324         case 2:
 325             {
 326                 if(($ai = $runtime.getAttributeIndex("","itemType"))>=0) {
 327                     $runtime.consumeAttribute($ai);
 328                     $runtime.sendText(super._cookie, $value);
 329                 }
 330             }
 331             break;
 332         case 0:
 333             {
 334                 revertToParentFromText(result, super._cookie, $value);
 335             }
 336             break;
 337         case 5:
 338             {
 339                 NGCCHandler h = new qname(this, super._source, $runtime, 260);
 340                 spawnChildFromText(h, $value);
 341             }
 342             break;
 343         }
 344     }
 345 
 346     public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
 347         switch($__cookie__) {
 348         case 266:
 349             {
 350                 fa = ((ForeignAttributesImpl)$__result__);
 351                 $_ngcc_current_state = 7;
 352             }
 353             break;
 354         case 264:
 355             {
 356                 annotation = ((AnnotationImpl)$__result__);
 357                 $_ngcc_current_state = 2;
 358             }
 359             break;
 360         case 258:
 361             {
 362                 itemType = ((SimpleTypeImpl)$__result__);
 363                 $_ngcc_current_state = 1;
 364             }
 365             break;
 366         case 260:
 367             {
 368                 itemTypeName = ((UName)$__result__);
 369                 action1();
 370                 $_ngcc_current_state = 4;
 371             }
 372             break;
 373         }
 374     }
 375 
 376     public boolean accepted() {
 377         return(($_ngcc_current_state == 0));
 378     }
 379 
 380 
 381                 /** computed simple type object */
 382                 private ListSimpleTypeImpl result;
 383 
 384                 // reference to the base type
 385                 private Ref.SimpleType itemType;
 386 
 387                 // locator of <list>
 388                 private Locator lloc;
 389 
 390 }