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