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 import java.math.BigInteger;
  44 
  45 
  46 class occurs extends NGCCHandler {
  47     private String v;
  48     protected final NGCCRuntimeEx $runtime;
  49     private int $_ngcc_current_state;
  50     protected String $uri;
  51     protected String $localName;
  52     protected String $qname;
  53 
  54     public final NGCCRuntime getRuntime() {
  55         return($runtime);
  56     }
  57 
  58     public occurs(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
  59         super(source, parent, cookie);
  60         $runtime = runtime;
  61         $_ngcc_current_state = 5;
  62     }
  63 
  64     public occurs(NGCCRuntimeEx runtime) {
  65         this(null, runtime, runtime, -1);
  66     }
  67 
  68     private void action0()throws SAXException {
  69         min = new BigInteger(v);
  70 }
  71 
  72     private void action1()throws SAXException {
  73         max=BigInteger.valueOf(-1);
  74 }
  75 
  76     private void action2()throws SAXException {
  77         max = new BigInteger(v);
  78 }
  79 
  80     public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
  81         int $ai;
  82         $uri = $__uri;
  83         $localName = $__local;
  84         $qname = $__qname;
  85         switch($_ngcc_current_state) {
  86         case 1:
  87             {
  88                 if(($ai = $runtime.getAttributeIndex("","minOccurs"))>=0) {
  89                     $runtime.consumeAttribute($ai);
  90                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
  91                 }
  92                 else {
  93                     $_ngcc_current_state = 0;
  94                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
  95                 }
  96             }
  97             break;
  98         case 0:
  99             {
 100                 revertToParentFromEnterElement(this, super._cookie, $__uri, $__local, $__qname, $attrs);
 101             }
 102             break;
 103         case 5:
 104             {
 105                 if(($ai = $runtime.getAttributeIndex("","maxOccurs"))>=0) {
 106                     $runtime.consumeAttribute($ai);
 107                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 108                 }
 109                 else {
 110                     $_ngcc_current_state = 1;
 111                     $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
 112                 }
 113             }
 114             break;
 115         default:
 116             {
 117                 unexpectedEnterElement($__qname);
 118             }
 119             break;
 120         }
 121     }
 122 
 123     public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
 124         int $ai;
 125         $uri = $__uri;
 126         $localName = $__local;
 127         $qname = $__qname;
 128         switch($_ngcc_current_state) {
 129         case 1:
 130             {
 131                 if(($ai = $runtime.getAttributeIndex("","minOccurs"))>=0) {
 132                     $runtime.consumeAttribute($ai);
 133                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 134                 }
 135                 else {
 136                     $_ngcc_current_state = 0;
 137                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 138                 }
 139             }
 140             break;
 141         case 0:
 142             {
 143                 revertToParentFromLeaveElement(this, super._cookie, $__uri, $__local, $__qname);
 144             }
 145             break;
 146         case 5:
 147             {
 148                 if(($ai = $runtime.getAttributeIndex("","maxOccurs"))>=0) {
 149                     $runtime.consumeAttribute($ai);
 150                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 151                 }
 152                 else {
 153                     $_ngcc_current_state = 1;
 154                     $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
 155                 }
 156             }
 157             break;
 158         default:
 159             {
 160                 unexpectedLeaveElement($__qname);
 161             }
 162             break;
 163         }
 164     }
 165 
 166     public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
 167         int $ai;
 168         $uri = $__uri;
 169         $localName = $__local;
 170         $qname = $__qname;
 171         switch($_ngcc_current_state) {
 172         case 1:
 173             {
 174                 if(($__uri.equals("") && $__local.equals("minOccurs"))) {
 175                     $_ngcc_current_state = 3;
 176                 }
 177                 else {
 178                     $_ngcc_current_state = 0;
 179                     $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
 180                 }
 181             }
 182             break;
 183         case 0:
 184             {
 185                 revertToParentFromEnterAttribute(this, super._cookie, $__uri, $__local, $__qname);
 186             }
 187             break;
 188         case 5:
 189             {
 190                 if(($__uri.equals("") && $__local.equals("maxOccurs"))) {
 191                     $_ngcc_current_state = 7;
 192                 }
 193                 else {
 194                     $_ngcc_current_state = 1;
 195                     $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
 196                 }
 197             }
 198             break;
 199         default:
 200             {
 201                 unexpectedEnterAttribute($__qname);
 202             }
 203             break;
 204         }
 205     }
 206 
 207     public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
 208         int $ai;
 209         $uri = $__uri;
 210         $localName = $__local;
 211         $qname = $__qname;
 212         switch($_ngcc_current_state) {
 213         case 1:
 214             {
 215                 $_ngcc_current_state = 0;
 216                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
 217             }
 218             break;
 219         case 0:
 220             {
 221                 revertToParentFromLeaveAttribute(this, super._cookie, $__uri, $__local, $__qname);
 222             }
 223             break;
 224         case 2:
 225             {
 226                 if(($__uri.equals("") && $__local.equals("minOccurs"))) {
 227                     $_ngcc_current_state = 0;
 228                 }
 229                 else {
 230                     unexpectedLeaveAttribute($__qname);
 231                 }
 232             }
 233             break;
 234         case 5:
 235             {
 236                 $_ngcc_current_state = 1;
 237                 $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
 238             }
 239             break;
 240         case 6:
 241             {
 242                 if(($__uri.equals("") && $__local.equals("maxOccurs"))) {
 243                     $_ngcc_current_state = 1;
 244                 }
 245                 else {
 246                     unexpectedLeaveAttribute($__qname);
 247                 }
 248             }
 249             break;
 250         default:
 251             {
 252                 unexpectedLeaveAttribute($__qname);
 253             }
 254             break;
 255         }
 256     }
 257 
 258     public void text(String $value) throws SAXException {
 259         int $ai;
 260         switch($_ngcc_current_state) {
 261         case 1:
 262             {
 263                 if(($ai = $runtime.getAttributeIndex("","minOccurs"))>=0) {
 264                     $runtime.consumeAttribute($ai);
 265                     $runtime.sendText(super._cookie, $value);
 266                 }
 267                 else {
 268                     $_ngcc_current_state = 0;
 269                     $runtime.sendText(super._cookie, $value);
 270                 }
 271             }
 272             break;
 273         case 0:
 274             {
 275                 revertToParentFromText(this, super._cookie, $value);
 276             }
 277             break;
 278         case 3:
 279             {
 280                 v = $value;
 281                 $_ngcc_current_state = 2;
 282                 action0();
 283             }
 284             break;
 285         case 5:
 286             {
 287                 if(($ai = $runtime.getAttributeIndex("","maxOccurs"))>=0) {
 288                     $runtime.consumeAttribute($ai);
 289                     $runtime.sendText(super._cookie, $value);
 290                 }
 291                 else {
 292                     $_ngcc_current_state = 1;
 293                     $runtime.sendText(super._cookie, $value);
 294                 }
 295             }
 296             break;
 297         case 7:
 298             {
 299                 if($value.equals("unbounded")) {
 300                     $_ngcc_current_state = 6;
 301                     action1();
 302                 }
 303                 else {
 304                     v = $value;
 305                     $_ngcc_current_state = 6;
 306                     action2();
 307                 }
 308             }
 309             break;
 310         }
 311     }
 312 
 313     public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
 314         switch($__cookie__) {
 315         }
 316     }
 317 
 318     public boolean accepted() {
 319         return((($_ngcc_current_state == 5) || (($_ngcc_current_state == 0) || ($_ngcc_current_state == 1))));
 320     }
 321 
 322 
 323       BigInteger max = BigInteger.valueOf(1);
 324       BigInteger min = BigInteger.valueOf(1);
 325 
 326 }