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