01: /*
02: * The contents of this file are subject to the terms
03: * of the Common Development and Distribution License
04: * (the "License"). You may not use this file except
05: * in compliance with the License.
06: *
07: * You can obtain a copy of the license at
08: * https://jwsdp.dev.java.net/CDDLv1.0.html
09: * See the License for the specific language governing
10: * permissions and limitations under the License.
11: *
12: * When distributing Covered Code, include this CDDL
13: * HEADER in each file and include the License file at
14: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
15: * add the following below this CDDL HEADER, with the
16: * fields enclosed by brackets "[]" replaced with your
17: * own identifying information: Portions Copyright [yyyy]
18: * [name of copyright owner]
19: */
20: package com.sun.xml.xsom;
21:
22: import com.sun.xml.xsom.visitor.XSTermFunction;
23: import com.sun.xml.xsom.visitor.XSTermVisitor;
24: import com.sun.xml.xsom.visitor.XSTermFunctionWithParam;
25:
26: /**
27: * A component that can be referenced from {@link XSParticle}
28: *
29: * This interface provides a set of type check functions (<code>isXXX</code>),
30: * which are essentially:
31: *
32: * <pre>
33: * boolean isXXX() {
34: * return this instanceof XXX;
35: * }
36: * <pre>
37: *
38: * and a set of cast functions (<code>asXXX</code>), which are
39: * essentially:
40: *
41: * <pre>
42: * XXX asXXX() {
43: * if(isXXX()) return (XXX)this;
44: * else return null;
45: * }
46: * </pre>
47: */
48: public interface XSTerm extends XSComponent {
49: void visit(XSTermVisitor visitor);
50:
51: <T> T apply(XSTermFunction<T> function);
52:
53: <T, P> T apply(XSTermFunctionWithParam<T, P> function, P param);
54:
55: // cast functions
56: boolean isWildcard();
57:
58: boolean isModelGroupDecl();
59:
60: boolean isModelGroup();
61:
62: boolean isElementDecl();
63:
64: XSWildcard asWildcard();
65:
66: XSModelGroupDecl asModelGroupDecl();
67:
68: XSModelGroup asModelGroup();
69:
70: XSElementDecl asElementDecl();
71: }
|