001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package org.netbeans.modules.xml.schema.model.visitor;
043:
044: import org.netbeans.modules.xml.schema.model.*;
045:
046: /**
047: * This visitor will visit all nodes in a tree. A typical subclass visitor
048: * would inherit from this class and override methods for elements which need
049: * to be visited. This would remove the reliance on the heirarchy for visiting.
050: * @author Chris Webster
051: */
052: public class DeepSchemaVisitor implements SchemaVisitor {
053: public void visit(LocalSimpleType type) {
054: visitChildren(type);
055: }
056:
057: public void visit(Union u) {
058: visitChildren(u);
059: }
060:
061: public void visit(Enumeration e) {
062: visitChildren(e);
063: }
064:
065: public void visit(AttributeGroupReference agr) {
066: visitChildren(agr);
067: }
068:
069: public void visit(GlobalAttributeGroup gag) {
070: visitChildren(gag);
071: }
072:
073: public void visit(KeyRef kr) {
074: visitChildren(kr);
075: }
076:
077: public void visit(GlobalSimpleType gst) {
078: visitChildren(gst);
079: }
080:
081: public void visit(AnyElement any) {
082: visitChildren(any);
083: }
084:
085: public void visit(Include include) {
086: visitChildren(include);
087: }
088:
089: public void visit(MinInclusive mi) {
090: visitChildren(mi);
091: }
092:
093: public void visit(Import im) {
094: visitChildren(im);
095: }
096:
097: public void visit(Choice choice) {
098: visitChildren(choice);
099: }
100:
101: public void visit(Unique u) {
102: visitChildren(u);
103: }
104:
105: public void visit(MaxLength ml) {
106: visitChildren(ml);
107: }
108:
109: public void visit(Redefine rd) {
110: visitChildren(rd);
111: }
112:
113: public void visit(SimpleContentRestriction scr) {
114: visitChildren(scr);
115: }
116:
117: public void visit(LocalElement le) {
118: visitChildren(le);
119: }
120:
121: public void visit(ElementReference le) {
122: visitChildren(le);
123: }
124:
125: public void visit(Selector s) {
126: visitChildren(s);
127: }
128:
129: public void visit(Annotation ann) {
130: visitChildren(ann);
131: }
132:
133: public void visit(ComplexExtension ce) {
134: visitChildren(ce);
135: }
136:
137: public void visit(FractionDigits fd) {
138: visitChildren(fd);
139: }
140:
141: public void visit(SimpleExtension se) {
142: visitChildren(se);
143: }
144:
145: public void visit(Whitespace ws) {
146: visitChildren(ws);
147: }
148:
149: public void visit(LocalComplexType type) {
150: visitChildren(type);
151: }
152:
153: public void visit(TotalDigits td) {
154: visitChildren(td);
155: }
156:
157: public void visit(MaxExclusive me) {
158: visitChildren(me);
159: }
160:
161: public void visit(SimpleContent sc) {
162: visitChildren(sc);
163: }
164:
165: public void visit(AnyAttribute anyAttr) {
166: visitChildren(anyAttr);
167: }
168:
169: public void visit(GlobalAttribute ga) {
170: visitChildren(ga);
171: }
172:
173: public void visit(All all) {
174: visitChildren(all);
175: }
176:
177: public void visit(ComplexContentRestriction ccr) {
178: visitChildren(ccr);
179: }
180:
181: public void visit(GroupReference gr) {
182: visitChildren(gr);
183: }
184:
185: public void visit(Key key) {
186: visitChildren(key);
187: }
188:
189: public void visit(List l) {
190: visitChildren(l);
191: }
192:
193: public void visit(Pattern p) {
194: visitChildren(p);
195: }
196:
197: public void visit(Documentation d) {
198: visitChildren(d);
199: }
200:
201: public void visit(AppInfo d) {
202: visitChildren(d);
203: }
204:
205: public void visit(Notation notation) {
206: visitChildren(notation);
207: }
208:
209: public void visit(MinExclusive me) {
210: visitChildren(me);
211: }
212:
213: public void visit(GlobalGroup gd) {
214: visitChildren(gd);
215: }
216:
217: public void visit(MinLength ml) {
218: visitChildren(ml);
219: }
220:
221: public void visit(Schema s) {
222: visitChildren(s);
223: }
224:
225: public void visit(GlobalComplexType gct) {
226: visitChildren(gct);
227: }
228:
229: public void visit(Sequence s) {
230: visitChildren(s);
231: }
232:
233: public void visit(MaxInclusive mi) {
234: visitChildren(mi);
235: }
236:
237: public void visit(SimpleTypeRestriction str) {
238: visitChildren(str);
239: }
240:
241: public void visit(LocalAttribute la) {
242: visitChildren(la);
243: }
244:
245: public void visit(AttributeReference la) {
246: visitChildren(la);
247: }
248:
249: public void visit(ComplexContent cc) {
250: visitChildren(cc);
251: }
252:
253: public void visit(GlobalElement ge) {
254: visitChildren(ge);
255: }
256:
257: public void visit(Length length) {
258: visitChildren(length);
259: }
260:
261: public void visit(Field f) {
262: visitChildren(f);
263: }
264:
265: protected void visitChildren(SchemaComponent sc) {
266: for (SchemaComponent child : sc.getChildren()) {
267: child.accept(this);
268: }
269: }
270: }
|