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
43
44
45class ersSet extends NGCCHandler {
46    private String v;
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 ersSet(NGCCHandler parent, NGCCEventSource source, NGCCRuntimeEx runtime, int cookie) {
58        super(source, parent, cookie);
59        $runtime = runtime;
60        $_ngcc_current_state = 1;
61    }
62
63    public ersSet(NGCCRuntimeEx runtime) {
64        this(null, runtime, runtime, -1);
65    }
66
67    public void enterElement(String $__uri, String $__local, String $__qname, Attributes $attrs) throws SAXException {
68        int $ai;
69        $uri = $__uri;
70        $localName = $__local;
71        $qname = $__qname;
72        switch($_ngcc_current_state) {
73        case 0:
74            {
75                revertToParentFromEnterElement(makeResult(), super._cookie, $__uri, $__local, $__qname, $attrs);
76            }
77            break;
78        default:
79            {
80                unexpectedEnterElement($__qname);
81            }
82            break;
83        }
84    }
85
86    public void leaveElement(String $__uri, String $__local, String $__qname) throws SAXException {
87        int $ai;
88        $uri = $__uri;
89        $localName = $__local;
90        $qname = $__qname;
91        switch($_ngcc_current_state) {
92        case 0:
93            {
94                revertToParentFromLeaveElement(makeResult(), super._cookie, $__uri, $__local, $__qname);
95            }
96            break;
97        default:
98            {
99                unexpectedLeaveElement($__qname);
100            }
101            break;
102        }
103    }
104
105    public void enterAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
106        int $ai;
107        $uri = $__uri;
108        $localName = $__local;
109        $qname = $__qname;
110        switch($_ngcc_current_state) {
111        case 0:
112            {
113                revertToParentFromEnterAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
114            }
115            break;
116        default:
117            {
118                unexpectedEnterAttribute($__qname);
119            }
120            break;
121        }
122    }
123
124    public void leaveAttribute(String $__uri, String $__local, String $__qname) throws SAXException {
125        int $ai;
126        $uri = $__uri;
127        $localName = $__local;
128        $qname = $__qname;
129        switch($_ngcc_current_state) {
130        case 0:
131            {
132                revertToParentFromLeaveAttribute(makeResult(), super._cookie, $__uri, $__local, $__qname);
133            }
134            break;
135        default:
136            {
137                unexpectedLeaveAttribute($__qname);
138            }
139            break;
140        }
141    }
142
143    public void text(String $value) throws SAXException {
144        int $ai;
145        switch($_ngcc_current_state) {
146        case 0:
147            {
148                revertToParentFromText(makeResult(), super._cookie, $value);
149            }
150            break;
151        case 1:
152            {
153                v = $value;
154                $_ngcc_current_state = 0;
155            }
156            break;
157        }
158    }
159
160    public void onChildCompleted(Object $__result__, int $__cookie__, boolean $__needAttCheck__)throws SAXException {
161        switch($__cookie__) {
162        }
163    }
164
165    public boolean accepted() {
166        return(($_ngcc_current_state == 0));
167    }
168
169
170      private Integer makeResult() {
171        if(v==null)     return new Integer($runtime.blockDefault);
172
173        if(v.indexOf("#all")!=-1)
174            return new Integer(
175              XSType.EXTENSION|XSType.RESTRICTION|XSType.SUBSTITUTION);
176
177        int r = 0;
178
179        if(v.indexOf("extension")!=-1)      r|=XSType.EXTENSION;
180        if(v.indexOf("restriction")!=-1)    r|=XSType.RESTRICTION;
181        if(v.indexOf("substitution")!=-1)   r|=XSType.SUBSTITUTION;
182
183        return new Integer(r);
184      }
185
186}
187