1/* 2 * Copyright (c) 1997, 2012, 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 26package com.sun.xml.internal.xsom.impl; 27 28import com.sun.xml.internal.xsom.XSElementDecl; 29import com.sun.xml.internal.xsom.XSModelGroup; 30import com.sun.xml.internal.xsom.XSModelGroupDecl; 31import com.sun.xml.internal.xsom.XSTerm; 32import com.sun.xml.internal.xsom.XSWildcard; 33import com.sun.xml.internal.xsom.impl.parser.SchemaDocumentImpl; 34import com.sun.xml.internal.xsom.visitor.XSFunction; 35import com.sun.xml.internal.xsom.visitor.XSTermFunction; 36import com.sun.xml.internal.xsom.visitor.XSTermFunctionWithParam; 37import com.sun.xml.internal.xsom.visitor.XSTermVisitor; 38import com.sun.xml.internal.xsom.visitor.XSVisitor; 39import org.xml.sax.Locator; 40 41public 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 ) { 47 48 super(owner,_annon,_loc,_fa,_targetNamespace,_name,false); 49 this.modelGroup = _modelGroup; 50 51 if(modelGroup==null) 52 throw new IllegalArgumentException(); 53 } 54 55 private final ModelGroupImpl modelGroup; 56 public XSModelGroup getModelGroup() { return modelGroup; } 57 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 } 65 66 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 } 76 77 public <T,P> T apply(XSTermFunctionWithParam<T, P> function, P param) { 78 return function.modelGroupDecl(this,param); 79 } 80 81 public Object apply( XSFunction function ) { 82 return function.modelGroupDecl(this); 83 } 84 85 86 public boolean isWildcard() { return false; } 87 public boolean isModelGroupDecl() { return true; } 88 public boolean isModelGroup() { return false; } 89 public boolean isElementDecl() { return false; } 90 91 public XSWildcard asWildcard() { return null; } 92 public XSModelGroupDecl asModelGroupDecl() { return this; } 93 public XSModelGroup asModelGroup() { return null; } 94 public XSElementDecl asElementDecl() { return null; } 95 96 97 // Ref.Term implementation 98 public XSTerm getTerm() { return this; } 99} 100