001: /*
002: * Copyright 2006 Sun Microsystems, Inc. All Rights Reserved.
003: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004: *
005: * This code is free software; you can redistribute it and/or modify it
006: * under the terms of the GNU General Public License version 2 only, as
007: * published by the Free Software Foundation. Sun designates this
008: * particular file as subject to the "Classpath" exception as provided
009: * by Sun in the LICENSE file that accompanied this code.
010: *
011: * This code is distributed in the hope that it will be useful, but WITHOUT
012: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
013: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
014: * version 2 for more details (a copy is included in the LICENSE file that
015: * accompanied this code).
016: *
017: * You should have received a copy of the GNU General Public License version
018: * 2 along with this work; if not, write to the Free Software Foundation,
019: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
020: *
021: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
022: * CA 95054 USA or visit www.sun.com if you need additional information or
023: * have any questions.
024: */
025:
026: /* this file is generated by RelaxNGCC */
027: package com.sun.xml.internal.xsom.impl.parser.state;
028:
029: import org.xml.sax.SAXException;
030: import org.xml.sax.XMLReader;
031: import org.xml.sax.Attributes;
032: import com.sun.xml.internal.xsom.impl.parser.NGCCRuntimeEx;
033:
034: import com.sun.xml.internal.xsom.*;
035: import com.sun.xml.internal.xsom.parser.*;
036: import com.sun.xml.internal.xsom.impl.*;
037: import com.sun.xml.internal.xsom.impl.parser.*;
038: import org.xml.sax.Locator;
039: import org.xml.sax.ContentHandler;
040: import org.xml.sax.helpers.*;
041: import java.util.*;
042:
043: import java.util.Vector;
044:
045: class modelGroupBody extends NGCCHandler {
046: private AnnotationImpl annotation;
047: private String compositorName;
048: private Locator locator;
049: private ParticleImpl childParticle;
050: private ForeignAttributesImpl fa;
051: protected final NGCCRuntimeEx $runtime;
052: private int $_ngcc_current_state;
053: protected String $uri;
054: protected String $localName;
055: protected String $qname;
056:
057: public final NGCCRuntime getRuntime() {
058: return ($runtime);
059: }
060:
061: public modelGroupBody(NGCCHandler parent, NGCCEventSource source,
062: NGCCRuntimeEx runtime, int cookie, Locator _locator,
063: String _compositorName) {
064: super (source, parent, cookie);
065: $runtime = runtime;
066: this .locator = _locator;
067: this .compositorName = _compositorName;
068: $_ngcc_current_state = 6;
069: }
070:
071: public modelGroupBody(NGCCRuntimeEx runtime, Locator _locator,
072: String _compositorName) {
073: this (null, runtime, runtime, -1, _locator, _compositorName);
074: }
075:
076: private void action0() throws SAXException {
077:
078: XSModelGroup.Compositor compositor = null;
079: if (compositorName.equals("all"))
080: compositor = XSModelGroup.ALL;
081: if (compositorName.equals("sequence"))
082: compositor = XSModelGroup.SEQUENCE;
083: if (compositorName.equals("choice"))
084: compositor = XSModelGroup.CHOICE;
085: if (compositor == null)
086: throw new InternalError("unable to process "
087: + compositorName);
088:
089: result = new ModelGroupImpl($runtime.document, annotation,
090: locator, fa, compositor, (ParticleImpl[]) particles
091: .toArray(new ParticleImpl[0]));
092:
093: }
094:
095: private void action1() throws SAXException {
096:
097: particles.add(childParticle);
098:
099: }
100:
101: public void enterElement(String $__uri, String $__local,
102: String $__qname, Attributes $attrs) throws SAXException {
103: int $ai;
104: $uri = $__uri;
105: $localName = $__local;
106: $qname = $__qname;
107: switch ($_ngcc_current_state) {
108: case 1: {
109: if ((((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
110: .equals("all")) || ($__uri
111: .equals("http://www.w3.org/2001/XMLSchema") && $__local
112: .equals("choice"))) || ($__uri
113: .equals("http://www.w3.org/2001/XMLSchema") && $__local
114: .equals("sequence"))) || (($__uri
115: .equals("http://www.w3.org/2001/XMLSchema") && $__local
116: .equals("group")) || (($__uri
117: .equals("http://www.w3.org/2001/XMLSchema") && $__local
118: .equals("element")) || ($__uri
119: .equals("http://www.w3.org/2001/XMLSchema") && $__local
120: .equals("any")))))) {
121: NGCCHandler h = new particle(this , super ._source,
122: $runtime, 669);
123: spawnChildFromEnterElement(h, $__uri, $__local,
124: $__qname, $attrs);
125: } else {
126: action0();
127: $_ngcc_current_state = 0;
128: $runtime.sendEnterElement(super ._cookie, $__uri,
129: $__local, $__qname, $attrs);
130: }
131: }
132: break;
133: case 2: {
134: if ((((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
135: .equals("all")) || ($__uri
136: .equals("http://www.w3.org/2001/XMLSchema") && $__local
137: .equals("choice"))) || ($__uri
138: .equals("http://www.w3.org/2001/XMLSchema") && $__local
139: .equals("sequence"))) || (($__uri
140: .equals("http://www.w3.org/2001/XMLSchema") && $__local
141: .equals("group")) || (($__uri
142: .equals("http://www.w3.org/2001/XMLSchema") && $__local
143: .equals("element")) || ($__uri
144: .equals("http://www.w3.org/2001/XMLSchema") && $__local
145: .equals("any")))))) {
146: NGCCHandler h = new particle(this , super ._source,
147: $runtime, 670);
148: spawnChildFromEnterElement(h, $__uri, $__local,
149: $__qname, $attrs);
150: } else {
151: $_ngcc_current_state = 1;
152: $runtime.sendEnterElement(super ._cookie, $__uri,
153: $__local, $__qname, $attrs);
154: }
155: }
156: break;
157: case 4: {
158: if (($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
159: .equals("annotation"))) {
160: NGCCHandler h = new annotation(this , super ._source,
161: $runtime, 673, null,
162: AnnotationContext.MODELGROUP);
163: spawnChildFromEnterElement(h, $__uri, $__local,
164: $__qname, $attrs);
165: } else {
166: $_ngcc_current_state = 2;
167: $runtime.sendEnterElement(super ._cookie, $__uri,
168: $__local, $__qname, $attrs);
169: }
170: }
171: break;
172: case 6: {
173: if ((($__uri.equals("http://www.w3.org/2001/XMLSchema") && $__local
174: .equals("annotation")) || (((($__uri
175: .equals("http://www.w3.org/2001/XMLSchema") && $__local
176: .equals("all")) || ($__uri
177: .equals("http://www.w3.org/2001/XMLSchema") && $__local
178: .equals("choice"))) || ($__uri
179: .equals("http://www.w3.org/2001/XMLSchema") && $__local
180: .equals("sequence"))) || (($__uri
181: .equals("http://www.w3.org/2001/XMLSchema") && $__local
182: .equals("group")) || (($__uri
183: .equals("http://www.w3.org/2001/XMLSchema") && $__local
184: .equals("element")) || ($__uri
185: .equals("http://www.w3.org/2001/XMLSchema") && $__local
186: .equals("any"))))))) {
187: NGCCHandler h = new foreignAttributes(this ,
188: super ._source, $runtime, 675, null);
189: spawnChildFromEnterElement(h, $__uri, $__local,
190: $__qname, $attrs);
191: } else {
192: NGCCHandler h = new foreignAttributes(this ,
193: super ._source, $runtime, 675, null);
194: spawnChildFromEnterElement(h, $__uri, $__local,
195: $__qname, $attrs);
196: }
197: }
198: break;
199: case 0: {
200: revertToParentFromEnterElement(result, super ._cookie,
201: $__uri, $__local, $__qname, $attrs);
202: }
203: break;
204: default: {
205: unexpectedEnterElement($__qname);
206: }
207: break;
208: }
209: }
210:
211: public void leaveElement(String $__uri, String $__local,
212: String $__qname) throws SAXException {
213: int $ai;
214: $uri = $__uri;
215: $localName = $__local;
216: $qname = $__qname;
217: switch ($_ngcc_current_state) {
218: case 1: {
219: action0();
220: $_ngcc_current_state = 0;
221: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
222: $__qname);
223: }
224: break;
225: case 2: {
226: $_ngcc_current_state = 1;
227: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
228: $__qname);
229: }
230: break;
231: case 4: {
232: $_ngcc_current_state = 2;
233: $runtime.sendLeaveElement(super ._cookie, $__uri, $__local,
234: $__qname);
235: }
236: break;
237: case 6: {
238: NGCCHandler h = new foreignAttributes(this , super ._source,
239: $runtime, 675, null);
240: spawnChildFromLeaveElement(h, $__uri, $__local, $__qname);
241: }
242: break;
243: case 0: {
244: revertToParentFromLeaveElement(result, super ._cookie,
245: $__uri, $__local, $__qname);
246: }
247: break;
248: default: {
249: unexpectedLeaveElement($__qname);
250: }
251: break;
252: }
253: }
254:
255: public void enterAttribute(String $__uri, String $__local,
256: String $__qname) throws SAXException {
257: int $ai;
258: $uri = $__uri;
259: $localName = $__local;
260: $qname = $__qname;
261: switch ($_ngcc_current_state) {
262: case 1: {
263: action0();
264: $_ngcc_current_state = 0;
265: $runtime.sendEnterAttribute(super ._cookie, $__uri,
266: $__local, $__qname);
267: }
268: break;
269: case 2: {
270: $_ngcc_current_state = 1;
271: $runtime.sendEnterAttribute(super ._cookie, $__uri,
272: $__local, $__qname);
273: }
274: break;
275: case 4: {
276: $_ngcc_current_state = 2;
277: $runtime.sendEnterAttribute(super ._cookie, $__uri,
278: $__local, $__qname);
279: }
280: break;
281: case 6: {
282: NGCCHandler h = new foreignAttributes(this , super ._source,
283: $runtime, 675, null);
284: spawnChildFromEnterAttribute(h, $__uri, $__local, $__qname);
285: }
286: break;
287: case 0: {
288: revertToParentFromEnterAttribute(result, super ._cookie,
289: $__uri, $__local, $__qname);
290: }
291: break;
292: default: {
293: unexpectedEnterAttribute($__qname);
294: }
295: break;
296: }
297: }
298:
299: public void leaveAttribute(String $__uri, String $__local,
300: String $__qname) throws SAXException {
301: int $ai;
302: $uri = $__uri;
303: $localName = $__local;
304: $qname = $__qname;
305: switch ($_ngcc_current_state) {
306: case 1: {
307: action0();
308: $_ngcc_current_state = 0;
309: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
310: $__local, $__qname);
311: }
312: break;
313: case 2: {
314: $_ngcc_current_state = 1;
315: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
316: $__local, $__qname);
317: }
318: break;
319: case 4: {
320: $_ngcc_current_state = 2;
321: $runtime.sendLeaveAttribute(super ._cookie, $__uri,
322: $__local, $__qname);
323: }
324: break;
325: case 6: {
326: NGCCHandler h = new foreignAttributes(this , super ._source,
327: $runtime, 675, null);
328: spawnChildFromLeaveAttribute(h, $__uri, $__local, $__qname);
329: }
330: break;
331: case 0: {
332: revertToParentFromLeaveAttribute(result, super ._cookie,
333: $__uri, $__local, $__qname);
334: }
335: break;
336: default: {
337: unexpectedLeaveAttribute($__qname);
338: }
339: break;
340: }
341: }
342:
343: public void text(String $value) throws SAXException {
344: int $ai;
345: switch ($_ngcc_current_state) {
346: case 1: {
347: action0();
348: $_ngcc_current_state = 0;
349: $runtime.sendText(super ._cookie, $value);
350: }
351: break;
352: case 2: {
353: $_ngcc_current_state = 1;
354: $runtime.sendText(super ._cookie, $value);
355: }
356: break;
357: case 4: {
358: $_ngcc_current_state = 2;
359: $runtime.sendText(super ._cookie, $value);
360: }
361: break;
362: case 6: {
363: NGCCHandler h = new foreignAttributes(this , super ._source,
364: $runtime, 675, null);
365: spawnChildFromText(h, $value);
366: }
367: break;
368: case 0: {
369: revertToParentFromText(result, super ._cookie, $value);
370: }
371: break;
372: }
373: }
374:
375: public void onChildCompleted(Object $__result__, int $__cookie__,
376: boolean $__needAttCheck__) throws SAXException {
377: switch ($__cookie__) {
378: case 669: {
379: childParticle = ((ParticleImpl) $__result__);
380: action1();
381: $_ngcc_current_state = 1;
382: }
383: break;
384: case 670: {
385: childParticle = ((ParticleImpl) $__result__);
386: action1();
387: $_ngcc_current_state = 1;
388: }
389: break;
390: case 675: {
391: fa = ((ForeignAttributesImpl) $__result__);
392: $_ngcc_current_state = 4;
393: }
394: break;
395: case 673: {
396: annotation = ((AnnotationImpl) $__result__);
397: $_ngcc_current_state = 2;
398: }
399: break;
400: }
401: }
402:
403: public boolean accepted() {
404: return ((($_ngcc_current_state == 0) || (($_ngcc_current_state == 4) || (($_ngcc_current_state == 2) || ($_ngcc_current_state == 1)))));
405: }
406:
407: private ModelGroupImpl result;
408:
409: private final List particles = new ArrayList();
410:
411: }
|