Thu, 31 Aug 2017 15:18:52 +0800
merge
1 /*
2 * Copyright (c) 1997, 2011, 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 */
26 package com.sun.xml.internal.xsom.impl;
28 import com.sun.xml.internal.xsom.XSElementDecl;
29 import com.sun.xml.internal.xsom.XSModelGroup;
30 import com.sun.xml.internal.xsom.XSModelGroupDecl;
31 import com.sun.xml.internal.xsom.XSTerm;
32 import com.sun.xml.internal.xsom.XSWildcard;
33 import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl;
34 import com.sun.xml.internal.xsom.visitor.XSFunction;
35 import com.sun.xml.internal.xsom.visitor.XSTermFunction;
36 import com.sun.xml.internal.xsom.visitor.XSTermFunctionWithParam;
37 import com.sun.xml.internal.xsom.visitor.XSTermVisitor;
38 import com.sun.xml.internal.xsom.visitor.XSVisitor;
39 import org.xml.sax.Locator;
41 public class ModelGroupDeclImpl extends DeclarationImpl implements XSModelGroupDecl, Ref.Term
42 {
43 public ModelGroupDeclImpl( SchemaDocumentImpl owner,
44 AnnotationImpl _annon, Locator _loc, ForeignAttributesImpl _fa,
45 String _targetNamespace, String _name,
46 ModelGroupImpl _modelGroup ) {
48 super(owner,_annon,_loc,_fa,_targetNamespace,_name,false);
49 this.modelGroup = _modelGroup;
51 if(modelGroup==null)
52 throw new IllegalArgumentException();
53 }
55 private final ModelGroupImpl modelGroup;
56 public XSModelGroup getModelGroup() { return modelGroup; }
58 /**
59 * This component is a redefinition of "oldMG". Fix up the internal state
60 * as such.
61 */
62 public void redefine( ModelGroupDeclImpl oldMG ) {
63 modelGroup.redefine(oldMG);
64 }
67 public void visit( XSVisitor visitor ) {
68 visitor.modelGroupDecl(this);
69 }
70 public void visit( XSTermVisitor visitor ) {
71 visitor.modelGroupDecl(this);
72 }
73 public Object apply( XSTermFunction function ) {
74 return function.modelGroupDecl(this);
75 }
77 public <T,P> T apply(XSTermFunctionWithParam<T, P> function, P param) {
78 return function.modelGroupDecl(this,param);
79 }
81 public Object apply( XSFunction function ) {
82 return function.modelGroupDecl(this);
83 }
86 public boolean isWildcard() { return false; }
87 public boolean isModelGroupDecl() { return true; }
88 public boolean isModelGroup() { return false; }
89 public boolean isElementDecl() { return false; }
91 public XSWildcard asWildcard() { return null; }
92 public XSModelGroupDecl asModelGroupDecl() { return this; }
93 public XSModelGroup asModelGroup() { return null; }
94 public XSElementDecl asElementDecl() { return null; }
97 // Ref.Term implementation
98 public XSTerm getTerm() { return this; }
99 }