001: /*
002: * The contents of this file are subject to the terms
003: * of the Common Development and Distribution License
004: * (the "License"). You may not use this file except
005: * in compliance with the License.
006: *
007: * You can obtain a copy of the license at
008: * https://jwsdp.dev.java.net/CDDLv1.0.html
009: * See the License for the specific language governing
010: * permissions and limitations under the License.
011: *
012: * When distributing Covered Code, include this CDDL
013: * HEADER in each file and include the License file at
014: * https://jwsdp.dev.java.net/CDDLv1.0.html If applicable,
015: * add the following below this CDDL HEADER, with the
016: * fields enclosed by brackets "[]" replaced with your
017: * own identifying information: Portions Copyright [yyyy]
018: * [name of copyright owner]
019: */
020: package com.sun.xml.xsom.impl;
021:
022: import com.sun.xml.xsom.XSElementDecl;
023: import com.sun.xml.xsom.XSModelGroup;
024: import com.sun.xml.xsom.XSModelGroupDecl;
025: import com.sun.xml.xsom.XSTerm;
026: import com.sun.xml.xsom.XSWildcard;
027: import com.sun.xml.xsom.impl.parser.SchemaDocumentImpl;
028: import com.sun.xml.xsom.visitor.XSFunction;
029: import com.sun.xml.xsom.visitor.XSTermFunction;
030: import com.sun.xml.xsom.visitor.XSTermFunctionWithParam;
031: import com.sun.xml.xsom.visitor.XSTermVisitor;
032: import com.sun.xml.xsom.visitor.XSVisitor;
033: import org.xml.sax.Locator;
034:
035: public class ModelGroupDeclImpl extends DeclarationImpl implements
036: XSModelGroupDecl, Ref.Term {
037: public ModelGroupDeclImpl(SchemaDocumentImpl owner,
038: AnnotationImpl _annon, Locator _loc,
039: ForeignAttributesImpl _fa, String _targetNamespace,
040: String _name, ModelGroupImpl _modelGroup) {
041:
042: super (owner, _annon, _loc, _fa, _targetNamespace, _name, false);
043: this .modelGroup = _modelGroup;
044:
045: if (modelGroup == null)
046: throw new IllegalArgumentException();
047: }
048:
049: private final ModelGroupImpl modelGroup;
050:
051: public XSModelGroup getModelGroup() {
052: return modelGroup;
053: }
054:
055: /**
056: * This component is a redefinition of "oldMG". Fix up the internal state
057: * as such.
058: */
059: public void redefine(ModelGroupDeclImpl oldMG) {
060: modelGroup.redefine(oldMG);
061: }
062:
063: public void visit(XSVisitor visitor) {
064: visitor.modelGroupDecl(this );
065: }
066:
067: public void visit(XSTermVisitor visitor) {
068: visitor.modelGroupDecl(this );
069: }
070:
071: public Object apply(XSTermFunction function) {
072: return function.modelGroupDecl(this );
073: }
074:
075: public <T, P> T apply(XSTermFunctionWithParam<T, P> function,
076: P param) {
077: return function.modelGroupDecl(this , param);
078: }
079:
080: public Object apply(XSFunction function) {
081: return function.modelGroupDecl(this );
082: }
083:
084: public boolean isWildcard() {
085: return false;
086: }
087:
088: public boolean isModelGroupDecl() {
089: return true;
090: }
091:
092: public boolean isModelGroup() {
093: return false;
094: }
095:
096: public boolean isElementDecl() {
097: return false;
098: }
099:
100: public XSWildcard asWildcard() {
101: return null;
102: }
103:
104: public XSModelGroupDecl asModelGroupDecl() {
105: return this ;
106: }
107:
108: public XSModelGroup asModelGroup() {
109: return null;
110: }
111:
112: public XSElementDecl asElementDecl() {
113: return null;
114: }
115:
116: // Ref.Term implementation
117: public XSTerm getTerm() {
118: return this;
119: }
120: }
|