1/*
2 * Copyright (c) 1997, 2013, 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 */
27package com.sun.xml.internal.xsom.impl.parser.state;
28import org.xml.sax.SAXException;
29import org.xml.sax.XMLReader;
30import org.xml.sax.Attributes;
31import 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
43import java.util.Vector;
44
45
46class modelGroupBody extends NGCCHandler {
47    private AnnotationImpl annotation;
48    private String compositorName;
49    private Locator locator;
50    private ParticleImpl childParticle;
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 modelGroupBody(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie, Locator _locator, String _compositorName) {
63        super(source, parent, cookie);
64        $runtime = runtime;
65        this.locator = _locator;
66        this.compositorName = _compositorName;
67        $_ngcc_current_state = 6;
68    }
69
70    public modelGroupBody(NGCCRuntimeEx runtime, Locator _locator, String _compositorName) {
71        this(null, runtime, runtime, -1, _locator, _compositorName);
72    }
73
74    private void action0()throws SAXException {
75
76      XSModelGroup.Compositor compositor = null;
77      if(compositorName.equals("all"))      compositor = XSModelGroup.ALL;
78      if(compositorName.equals("sequence")) compositor = XSModelGroup.SEQUENCE;
79      if(compositorName.equals("choice"))   compositor = XSModelGroup.CHOICE;
80      if(compositor==null)
81        throw new InternalError("unable to process "+compositorName);
82
83      result = new ModelGroupImpl( $runtime.document, annotation, locator, fa, compositor,
84            (ParticleImpl[])particles.toArray(new ParticleImpl[0]));
85
86}
87
88    private void action1()throws SAXException {
89
90        particles.add(childParticle);
91
92}
93
94    public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
95        int $ai;
96        $uri = $__uri;
97        $localName = $__local;
98        $qname = $__qname;
99        switch($_ngcc_current_state) {
100        case 0:
101            {
102                revertToParentFromEnterElement(result, super._cookie, $__uri, $__local, $__qname, $attrs);
103            }
104            break;
105        case 4:
106            {
107                if(($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("annotation"))) {
108                    NGCCHandler h = new annotation(this, super._source, $runtime, 174, null,AnnotationContext.MODELGROUP);
109                    spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
110                }
111                else {
112                    $_ngcc_current_state = 2;
113                    $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
114                }
115            }
116            break;
117        case 2:
118            {
119                if((($__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("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("any")))))) {
120                    NGCCHandler h = new particle(this, super._source, $runtime, 171);
121                    spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
122                }
123                else {
124                    $_ngcc_current_state = 1;
125                    $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
126                }
127            }
128            break;
129        case 6:
130            {
131                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("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("any"))))))) {
132                    NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 176, null);
133                    spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
134                }
135                else {
136                    NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 176, null);
137                    spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
138                }
139            }
140            break;
141        case 1:
142            {
143                if((($__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("all")) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("choice"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("sequence"))) || ($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local.equals("any")))))) {
144                    NGCCHandler h = new particle(this, super._source, $runtime, 170);
145                    spawnChildFromEnterElement(h, $__uri, $__local, $__qname, $attrs);
146                }
147                else {
148                    action0();
149                    $_ngcc_current_state = 0;
150                    $runtime.sendEnterElement(super._cookie, $__uri, $__local, $__qname, $attrs);
151                }
152            }
153            break;
154        default:
155            {
156                unexpectedEnterElement($__qname);
157            }
158            break;
159        }
160    }
161
162    public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
163        int $ai;
164        $uri = $__uri;
165        $localName = $__local;
166        $qname = $__qname;
167        switch($_ngcc_current_state) {
168        case 0:
169            {
170                revertToParentFromLeaveElement(result, super._cookie, $__uri, $__local, $__qname);
171            }
172            break;
173        case 4:
174            {
175                $_ngcc_current_state = 2;
176                $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
177            }
178            break;
179        case 2:
180            {
181                $_ngcc_current_state = 1;
182                $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
183            }
184            break;
185        case 6:
186            {
187                NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 176, null);
188                spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
189            }
190            break;
191        case 1:
192            {
193                action0();
194                $_ngcc_current_state = 0;
195                $runtime.sendLeaveElement(super._cookie, $__uri, $__local, $__qname);
196            }
197            break;
198        default:
199            {
200                unexpectedLeaveElement($__qname);
201            }
202            break;
203        }
204    }
205
206    public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
207        int $ai;
208        $uri = $__uri;
209        $localName = $__local;
210        $qname = $__qname;
211        switch($_ngcc_current_state) {
212        case 0:
213            {
214                revertToParentFromEnterAttribute(result, super._cookie, $__uri, $__local, $__qname);
215            }
216            break;
217        case 4:
218            {
219                $_ngcc_current_state = 2;
220                $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
221            }
222            break;
223        case 2:
224            {
225                $_ngcc_current_state = 1;
226                $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
227            }
228            break;
229        case 6:
230            {
231                NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 176, null);
232                spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
233            }
234            break;
235        case 1:
236            {
237                action0();
238                $_ngcc_current_state = 0;
239                $runtime.sendEnterAttribute(super._cookie, $__uri, $__local, $__qname);
240            }
241            break;
242        default:
243            {
244                unexpectedEnterAttribute($__qname);
245            }
246            break;
247        }
248    }
249
250    public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
251        int $ai;
252        $uri = $__uri;
253        $localName = $__local;
254        $qname = $__qname;
255        switch($_ngcc_current_state) {
256        case 0:
257            {
258                revertToParentFromLeaveAttribute(result, super._cookie, $__uri, $__local, $__qname);
259            }
260            break;
261        case 4:
262            {
263                $_ngcc_current_state = 2;
264                $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
265            }
266            break;
267        case 2:
268            {
269                $_ngcc_current_state = 1;
270                $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
271            }
272            break;
273        case 6:
274            {
275                NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 176, null);
276                spawnChildFromLeaveAttribute(h, $__uri, $__local, $__qname);
277            }
278            break;
279        case 1:
280            {
281                action0();
282                $_ngcc_current_state = 0;
283                $runtime.sendLeaveAttribute(super._cookie, $__uri, $__local, $__qname);
284            }
285            break;
286        default:
287            {
288                unexpectedLeaveAttribute($__qname);
289            }
290            break;
291        }
292    }
293
294    public void text(String $value) throws SAXException {
295        int $ai;
296        switch($_ngcc_current_state) {
297        case 0:
298            {
299                revertToParentFromText(result, super._cookie, $value);
300            }
301            break;
302        case 4:
303            {
304                $_ngcc_current_state = 2;
305                $runtime.sendText(super._cookie, $value);
306            }
307            break;
308        case 2:
309            {
310                $_ngcc_current_state = 1;
311                $runtime.sendText(super._cookie, $value);
312            }
313            break;
314        case 6:
315            {
316                NGCCHandler h = new foreignAttributes(this, super._source, $runtime, 176, null);
317                spawnChildFromText(h, $value);
318            }
319            break;
320        case 1:
321            {
322                action0();
323                $_ngcc_current_state = 0;
324                $runtime.sendText(super._cookie, $value);
325            }
326            break;
327        }
328    }
329
330    public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
331        switch($__cookie__) {
332        case 174:
333            {
334                annotation = ((AnnotationImpl)$__result__);
335                $_ngcc_current_state = 2;
336            }
337            break;
338        case 176:
339            {
340                fa = ((ForeignAttributesImpl)$__result__);
341                $_ngcc_current_state = 4;
342            }
343            break;
344        case 171:
345            {
346                childParticle = ((ParticleImpl)$__result__);
347                action1();
348                $_ngcc_current_state = 1;
349            }
350            break;
351        case 170:
352            {
353                childParticle = ((ParticleImpl)$__result__);
354                action1();
355                $_ngcc_current_state = 1;
356            }
357            break;
358        }
359    }
360
361    public boolean accepted() {
362        return((($_ngcc_current_state == 1) || (($_ngcc_current_state == 2) || (($_ngcc_current_state == 4) || ($_ngcc_current_state == 0)))));
363    }
364
365
366                private ModelGroupImpl result;
367
368                private final List particles = new ArrayList();
369
370}
371