blob: 48cade30ec9686c3035ae56d5f055e24702705ad [file] [log] [blame]
nitindd6e591d2005-03-14 22:21:57 +00001/*******************************************************************************
2 * Copyright (c) 2001, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11
12package org.eclipse.wst.dtd.core.internal.emf.impl;
13
14import org.eclipse.emf.common.notify.Notification;
15import org.eclipse.emf.common.notify.NotificationChain;
16import org.eclipse.emf.ecore.EClass;
17import org.eclipse.emf.ecore.EStructuralFeature;
18import org.eclipse.emf.ecore.InternalEObject;
19import org.eclipse.emf.ecore.impl.ENotificationImpl;
20import org.eclipse.emf.ecore.impl.EObjectImpl;
21import org.eclipse.emf.ecore.util.EcoreUtil;
22import org.eclipse.wst.dtd.core.internal.emf.DTDEntity;
23import org.eclipse.wst.dtd.core.internal.emf.DTDEntityContent;
24import org.eclipse.wst.dtd.core.internal.emf.DTDObject;
25import org.eclipse.wst.dtd.core.internal.emf.DTDPackage;
26import org.eclipse.wst.dtd.core.internal.emf.util.DTDPathnameUtil;
27
28/**
29 * @generated
30 */
31public abstract class DTDEntityContentImpl extends EObjectImpl implements DTDEntityContent {
32
33 public DTDEntityContentImpl() {
34 super();
35 }
36
37 /**
38 * <!-- begin-user-doc --> <!-- end-user-doc -->
39 *
40 * @generated
41 */
42 protected EClass eStaticClass() {
43 return DTDPackage.eINSTANCE.getDTDEntityContent();
44 }
45
46 public String getPathname() {
david_williams38046012005-04-08 19:04:29 +000047 return DTDPathnameUtil.makePath(getDTDEntity().getPathname(), "Content", null, -1); //$NON-NLS-1$
nitindd6e591d2005-03-14 22:21:57 +000048 }
49
50 public DTDObject findObject(String relativePath) {
51 return null;
52 }
53
54 /**
55 * @generated This field/method will be replaced during code generation
56 */
57 public DTDEntity getDTDEntity() {
58 if (eContainerFeatureID != DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY)
59 return null;
60 return (DTDEntity) eContainer;
61 }
62
63 /**
64 * @generated This field/method will be replaced during code generation.
65 */
66 public void setDTDEntity(DTDEntity newDTDEntity) {
67 if (newDTDEntity != eContainer || (eContainerFeatureID != DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY && newDTDEntity != null)) {
68 if (EcoreUtil.isAncestor(this, newDTDEntity))
david_williams38046012005-04-08 19:04:29 +000069 throw new IllegalArgumentException("Recursive containment not allowed for " + toString() + "."); //$NON-NLS-1$ //$NON-NLS-2$
nitindd6e591d2005-03-14 22:21:57 +000070 NotificationChain msgs = null;
71 if (eContainer != null)
72 msgs = eBasicRemoveFromContainer(msgs);
73 if (newDTDEntity != null)
74 msgs = ((InternalEObject) newDTDEntity).eInverseAdd(this, DTDPackage.DTD_ENTITY__CONTENT, DTDEntity.class, msgs);
75 msgs = eBasicSetContainer((InternalEObject) newDTDEntity, DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY, msgs);
76 if (msgs != null)
77 msgs.dispatch();
78 }
79 else if (eNotificationRequired())
80 eNotify(new ENotificationImpl(this, Notification.SET, DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY, newDTDEntity, newDTDEntity));
81 }
82
83 /**
84 * <!-- begin-user-doc --> <!-- end-user-doc -->
85 *
86 * @generated
87 */
88 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) {
89 if (featureID >= 0) {
90 switch (eDerivedStructuralFeatureID(featureID, baseClass)) {
91 case DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY :
92 if (eContainer != null)
93 msgs = eBasicRemoveFromContainer(msgs);
94 return eBasicSetContainer(otherEnd, DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY, msgs);
95 default :
96 return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs);
97 }
98 }
99 if (eContainer != null)
100 msgs = eBasicRemoveFromContainer(msgs);
101 return eBasicSetContainer(otherEnd, featureID, msgs);
102 }
103
104 /**
105 * <!-- begin-user-doc --> <!-- end-user-doc -->
106 *
107 * @generated
108 */
109 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) {
110 if (featureID >= 0) {
111 switch (baseClass == null ? featureID : eDerivedStructuralFeatureID(featureID, baseClass)) {
112 case DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY :
113 return eBasicSetContainer(null, DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY, msgs);
114 default :
115 return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs);
116 }
117 }
118 return eBasicSetContainer(null, featureID, msgs);
119 }
120
121 /**
122 * <!-- begin-user-doc --> <!-- end-user-doc -->
123 *
124 * @generated
125 */
126 public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) {
127 if (eContainerFeatureID >= 0) {
128 switch (eContainerFeatureID) {
129 case DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY :
130 return eContainer.eInverseRemove(this, DTDPackage.DTD_ENTITY__CONTENT, DTDEntity.class, msgs);
131 default :
132 return eDynamicBasicRemoveFromContainer(msgs);
133 }
134 }
135 return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs);
136 }
137
138 /**
139 * <!-- begin-user-doc --> <!-- end-user-doc -->
140 *
141 * @generated
142 */
143 public Object eGet(EStructuralFeature eFeature, boolean resolve) {
144 switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
145 case DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY :
146 return getDTDEntity();
147 }
148 return eDynamicGet(eFeature, resolve);
149 }
150
151 /**
152 * @generated This field/method will be replaced during code generation.
153 */
154 public boolean eIsSet(EStructuralFeature eFeature) {
155 switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
156 case DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY :
157 return getDTDEntity() != null;
158 }
159 return eDynamicIsSet(eFeature);
160 }
161
162 /**
163 * @generated This field/method will be replaced during code generation.
164 */
165 public void eSet(EStructuralFeature eFeature, Object newValue) {
166 switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
167 case DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY :
168 setDTDEntity((DTDEntity) newValue);
169 return;
170 }
171 eDynamicSet(eFeature, newValue);
172 }
173
174 /**
175 * @generated This field/method will be replaced during code generation.
176 */
177 public void eUnset(EStructuralFeature eFeature) {
178 switch (eDerivedStructuralFeatureID(eFeature.getFeatureID(), eFeature.getContainerClass())) {
179 case DTDPackage.DTD_ENTITY_CONTENT__DTD_ENTITY :
180 setDTDEntity((DTDEntity) null);
181 return;
182 }
183 eDynamicUnset(eFeature);
184 }
185
186 /*
187 * @see DTDEntityContent#unparse()
188 */
189 public String unparse() {
190 return null;
191 }
192
193}