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