1 7 package org.enhydra.dods.editor.Doml.impl; 8 9 import java.util.Collection ; 10 11 import org.eclipse.emf.common.notify.Notification; 12 import org.eclipse.emf.common.notify.NotificationChain; 13 14 import org.eclipse.emf.common.util.EList; 15 16 import org.eclipse.emf.ecore.EClass; 17 import org.eclipse.emf.ecore.EStructuralFeature; 18 import org.eclipse.emf.ecore.InternalEObject; 19 20 import org.eclipse.emf.ecore.impl.ENotificationImpl; 21 import org.eclipse.emf.ecore.impl.EObjectImpl; 22 23 import org.eclipse.emf.ecore.util.EObjectContainmentEList; 24 import org.eclipse.emf.ecore.util.InternalEList; 25 26 import org.enhydra.dods.editor.Doml.DomlPackage; 27 import org.enhydra.dods.editor.Doml.PackageType; 28 import org.enhydra.dods.editor.Doml.TableType; 29 30 45 public class PackageTypeImpl extends EObjectImpl implements PackageType { 46 54 protected EList package_ = null; 55 56 64 protected EList table = null; 65 66 74 protected static final String ID_EDEFAULT = null; 75 76 84 protected String id = ID_EDEFAULT; 85 86 91 protected PackageTypeImpl() { 92 super(); 93 } 94 95 100 protected EClass eStaticClass() { 101 return DomlPackage.eINSTANCE.getPackageType(); 102 } 103 104 109 public EList getPackage() { 110 if (package_ == null) { 111 package_ = new EObjectContainmentEList(PackageType.class, this, DomlPackage.PACKAGE_TYPE__PACKAGE); 112 } 113 return package_; 114 } 115 116 121 public EList getTable() { 122 if (table == null) { 123 table = new EObjectContainmentEList(TableType.class, this, DomlPackage.PACKAGE_TYPE__TABLE); 124 } 125 return table; 126 } 127 128 133 public String getId() { 134 return id; 135 } 136 137 142 public void setId(String newId) { 143 String oldId = id; 144 id = newId; 145 if (eNotificationRequired()) 146 eNotify(new ENotificationImpl(this, Notification.SET, DomlPackage.PACKAGE_TYPE__ID, oldId, id)); 147 } 148 149 154 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) { 155 if (featureID >= 0) { 156 switch (eDerivedStructuralFeatureID(featureID, baseClass)) { 157 case DomlPackage.PACKAGE_TYPE__PACKAGE: 158 return ((InternalEList)getPackage()).basicRemove(otherEnd, msgs); 159 case DomlPackage.PACKAGE_TYPE__TABLE: 160 return ((InternalEList)getTable()).basicRemove(otherEnd, msgs); 161 default: 162 return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); 163 } 164 } 165 return eBasicSetContainer(null, featureID, msgs); 166 } 167 168 173 public Object eGet(EStructuralFeature eFeature, boolean resolve) { 174 switch (eDerivedStructuralFeatureID(eFeature)) { 175 case DomlPackage.PACKAGE_TYPE__PACKAGE: 176 return getPackage(); 177 case DomlPackage.PACKAGE_TYPE__TABLE: 178 return getTable(); 179 case DomlPackage.PACKAGE_TYPE__ID: 180 return getId(); 181 } 182 return eDynamicGet(eFeature, resolve); 183 } 184 185 190 public void eSet(EStructuralFeature eFeature, Object newValue) { 191 switch (eDerivedStructuralFeatureID(eFeature)) { 192 case DomlPackage.PACKAGE_TYPE__PACKAGE: 193 getPackage().clear(); 194 getPackage().addAll((Collection )newValue); 195 return; 196 case DomlPackage.PACKAGE_TYPE__TABLE: 197 getTable().clear(); 198 getTable().addAll((Collection )newValue); 199 return; 200 case DomlPackage.PACKAGE_TYPE__ID: 201 setId((String )newValue); 202 return; 203 } 204 eDynamicSet(eFeature, newValue); 205 } 206 207 212 public void eUnset(EStructuralFeature eFeature) { 213 switch (eDerivedStructuralFeatureID(eFeature)) { 214 case DomlPackage.PACKAGE_TYPE__PACKAGE: 215 getPackage().clear(); 216 return; 217 case DomlPackage.PACKAGE_TYPE__TABLE: 218 getTable().clear(); 219 return; 220 case DomlPackage.PACKAGE_TYPE__ID: 221 setId(ID_EDEFAULT); 222 return; 223 } 224 eDynamicUnset(eFeature); 225 } 226 227 232 public boolean eIsSet(EStructuralFeature eFeature) { 233 switch (eDerivedStructuralFeatureID(eFeature)) { 234 case DomlPackage.PACKAGE_TYPE__PACKAGE: 235 return package_ != null && !package_.isEmpty(); 236 case DomlPackage.PACKAGE_TYPE__TABLE: 237 return table != null && !table.isEmpty(); 238 case DomlPackage.PACKAGE_TYPE__ID: 239 return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); 240 } 241 return eDynamicIsSet(eFeature); 242 } 243 244 249 public String toString() { 250 if (eIsProxy()) return super.toString(); 251 252 StringBuffer result = new StringBuffer (super.toString()); 253 result.append(" (id: "); 254 result.append(id); 255 result.append(')'); 256 return result.toString(); 257 } 258 259 } | Popular Tags |