$search
00001 00007 package org.best_of_robotics.model.datatypes.impl; 00008 00009 import java.lang.String; 00010 00011 import org.best_of_robotics.model.datatypes.DatatypesPackage; 00012 import org.best_of_robotics.model.datatypes.IDLReference; 00013 00014 import org.best_of_robotics.model.datatypes.TypesLibrary; 00015 import org.eclipse.emf.common.notify.Notification; 00016 00017 import org.eclipse.emf.common.notify.NotificationChain; 00018 import org.eclipse.emf.ecore.EClass; 00019 00020 import org.eclipse.emf.ecore.InternalEObject; 00021 import org.eclipse.emf.ecore.impl.ENotificationImpl; 00022 import org.eclipse.emf.ecore.impl.EObjectImpl; 00023 import org.eclipse.emf.ecore.util.EcoreUtil; 00024 00039 public abstract class IDLReferenceImpl extends EObjectImpl implements IDLReference { 00048 protected static final String NAME_EDEFAULT = null; 00049 00058 protected String name = NAME_EDEFAULT; 00059 00065 protected IDLReferenceImpl() { 00066 super(); 00067 } 00068 00074 @Override 00075 protected EClass eStaticClass() { 00076 return DatatypesPackage.Literals.IDL_REFERENCE; 00077 } 00078 00084 public String getName() { 00085 return name; 00086 } 00087 00093 public void setName(String newName) { 00094 String oldName = name; 00095 name = newName; 00096 if (eNotificationRequired()) 00097 eNotify(new ENotificationImpl(this, Notification.SET, DatatypesPackage.IDL_REFERENCE__NAME, oldName, name)); 00098 } 00099 00105 public TypesLibrary getTypesLibrary() { 00106 if (eContainerFeatureID() != DatatypesPackage.IDL_REFERENCE__TYPES_LIBRARY) return null; 00107 return (TypesLibrary)eContainer(); 00108 } 00109 00115 public NotificationChain basicSetTypesLibrary(TypesLibrary newTypesLibrary, NotificationChain msgs) { 00116 msgs = eBasicSetContainer((InternalEObject)newTypesLibrary, DatatypesPackage.IDL_REFERENCE__TYPES_LIBRARY, msgs); 00117 return msgs; 00118 } 00119 00125 public void setTypesLibrary(TypesLibrary newTypesLibrary) { 00126 if (newTypesLibrary != eInternalContainer() || (eContainerFeatureID() != DatatypesPackage.IDL_REFERENCE__TYPES_LIBRARY && newTypesLibrary != null)) { 00127 if (EcoreUtil.isAncestor(this, newTypesLibrary)) 00128 throw new IllegalArgumentException("Recursive containment not allowed for " + toString()); 00129 NotificationChain msgs = null; 00130 if (eInternalContainer() != null) 00131 msgs = eBasicRemoveFromContainer(msgs); 00132 if (newTypesLibrary != null) 00133 msgs = ((InternalEObject)newTypesLibrary).eInverseAdd(this, DatatypesPackage.TYPES_LIBRARY__TYPES, TypesLibrary.class, msgs); 00134 msgs = basicSetTypesLibrary(newTypesLibrary, msgs); 00135 if (msgs != null) msgs.dispatch(); 00136 } 00137 else if (eNotificationRequired()) 00138 eNotify(new ENotificationImpl(this, Notification.SET, DatatypesPackage.IDL_REFERENCE__TYPES_LIBRARY, newTypesLibrary, newTypesLibrary)); 00139 } 00140 00146 public String getLabel() { 00147 // TODO: implement this method 00148 // Ensure that you remove @generated or mark it @generated NOT 00149 throw new UnsupportedOperationException(); 00150 } 00151 00157 @Override 00158 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { 00159 switch (featureID) { 00160 case DatatypesPackage.IDL_REFERENCE__TYPES_LIBRARY: 00161 if (eInternalContainer() != null) 00162 msgs = eBasicRemoveFromContainer(msgs); 00163 return basicSetTypesLibrary((TypesLibrary)otherEnd, msgs); 00164 } 00165 return super.eInverseAdd(otherEnd, featureID, msgs); 00166 } 00167 00173 @Override 00174 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { 00175 switch (featureID) { 00176 case DatatypesPackage.IDL_REFERENCE__TYPES_LIBRARY: 00177 return basicSetTypesLibrary(null, msgs); 00178 } 00179 return super.eInverseRemove(otherEnd, featureID, msgs); 00180 } 00181 00187 @Override 00188 public NotificationChain eBasicRemoveFromContainerFeature(NotificationChain msgs) { 00189 switch (eContainerFeatureID()) { 00190 case DatatypesPackage.IDL_REFERENCE__TYPES_LIBRARY: 00191 return eInternalContainer().eInverseRemove(this, DatatypesPackage.TYPES_LIBRARY__TYPES, TypesLibrary.class, msgs); 00192 } 00193 return super.eBasicRemoveFromContainerFeature(msgs); 00194 } 00195 00201 @Override 00202 public Object eGet(int featureID, boolean resolve, boolean coreType) { 00203 switch (featureID) { 00204 case DatatypesPackage.IDL_REFERENCE__NAME: 00205 return getName(); 00206 case DatatypesPackage.IDL_REFERENCE__TYPES_LIBRARY: 00207 return getTypesLibrary(); 00208 } 00209 return super.eGet(featureID, resolve, coreType); 00210 } 00211 00217 @Override 00218 public void eSet(int featureID, Object newValue) { 00219 switch (featureID) { 00220 case DatatypesPackage.IDL_REFERENCE__NAME: 00221 setName((String)newValue); 00222 return; 00223 case DatatypesPackage.IDL_REFERENCE__TYPES_LIBRARY: 00224 setTypesLibrary((TypesLibrary)newValue); 00225 return; 00226 } 00227 super.eSet(featureID, newValue); 00228 } 00229 00235 @Override 00236 public void eUnset(int featureID) { 00237 switch (featureID) { 00238 case DatatypesPackage.IDL_REFERENCE__NAME: 00239 setName(NAME_EDEFAULT); 00240 return; 00241 case DatatypesPackage.IDL_REFERENCE__TYPES_LIBRARY: 00242 setTypesLibrary((TypesLibrary)null); 00243 return; 00244 } 00245 super.eUnset(featureID); 00246 } 00247 00253 @Override 00254 public boolean eIsSet(int featureID) { 00255 switch (featureID) { 00256 case DatatypesPackage.IDL_REFERENCE__NAME: 00257 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); 00258 case DatatypesPackage.IDL_REFERENCE__TYPES_LIBRARY: 00259 return getTypesLibrary() != null; 00260 } 00261 return super.eIsSet(featureID); 00262 } 00263 00269 @Override 00270 public String toString() { 00271 if (eIsProxy()) return super.toString(); 00272 00273 StringBuffer result = new StringBuffer(super.toString()); 00274 result.append(" (name: "); 00275 result.append(name); 00276 result.append(')'); 00277 return result.toString(); 00278 } 00279 00280 } //IDLReferenceImpl