1 17 package org.eclipse.emf.mapping.impl; 18 19 20 import java.util.Collection ; 21 22 import org.eclipse.emf.common.notify.Notification; 23 import org.eclipse.emf.common.notify.NotificationChain; 24 import org.eclipse.emf.ecore.EClass; 25 import org.eclipse.emf.ecore.EObject; 26 import org.eclipse.emf.ecore.EOperation; 27 import org.eclipse.emf.ecore.EStructuralFeature; 28 import org.eclipse.emf.ecore.InternalEObject; 29 import org.eclipse.emf.ecore.impl.ENotificationImpl; 30 import org.eclipse.emf.ecore.util.InternalEList; 31 import org.eclipse.emf.mapping.FunctionPair; 32 import org.eclipse.emf.mapping.Mapping; 33 import org.eclipse.emf.mapping.MappingHelper; 34 import org.eclipse.emf.mapping.MappingPackage; 35 36 37 51 public class FunctionPairImpl extends TypeConverterImpl implements FunctionPair 52 { 53 61 protected EOperation in2out = null; 62 63 71 protected EOperation out2in = null; 72 73 78 protected FunctionPairImpl() 79 { 80 super(); 81 } 82 83 88 protected EClass eStaticClass() 89 { 90 return MappingPackage.eINSTANCE.getFunctionPair(); 91 } 92 93 98 public EOperation getIn2out() 99 { 100 if (in2out != null && in2out.eIsProxy()) 101 { 102 EOperation oldIn2out = in2out; 103 in2out = (EOperation)eResolveProxy((InternalEObject)in2out); 104 if (in2out != oldIn2out) 105 { 106 if (eNotificationRequired()) 107 eNotify(new ENotificationImpl(this, Notification.RESOLVE, MappingPackage.FUNCTION_PAIR__IN2OUT, oldIn2out, in2out)); 108 } 109 } 110 return in2out; 111 } 112 113 118 public EOperation basicGetIn2out() 119 { 120 return in2out; 121 } 122 123 128 public void setIn2out(EOperation newIn2out) 129 { 130 EOperation oldIn2out = in2out; 131 in2out = newIn2out; 132 if (eNotificationRequired()) 133 eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.FUNCTION_PAIR__IN2OUT, oldIn2out, in2out)); 134 } 135 136 141 public EOperation getOut2in() 142 { 143 if (out2in != null && out2in.eIsProxy()) 144 { 145 EOperation oldOut2in = out2in; 146 out2in = (EOperation)eResolveProxy((InternalEObject)out2in); 147 if (out2in != oldOut2in) 148 { 149 if (eNotificationRequired()) 150 eNotify(new ENotificationImpl(this, Notification.RESOLVE, MappingPackage.FUNCTION_PAIR__OUT2IN, oldOut2in, out2in)); 151 } 152 } 153 return out2in; 154 } 155 156 161 public EOperation basicGetOut2in() 162 { 163 return out2in; 164 } 165 166 171 public void setOut2in(EOperation newOut2in) 172 { 173 EOperation oldOut2in = out2in; 174 out2in = newOut2in; 175 if (eNotificationRequired()) 176 eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.FUNCTION_PAIR__OUT2IN, oldOut2in, out2in)); 177 } 178 179 184 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 185 { 186 if (featureID >= 0) 187 { 188 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 189 { 190 case MappingPackage.FUNCTION_PAIR__MAPPER: 191 if (eContainer != null) 192 msgs = eBasicRemoveFromContainer(msgs); 193 return eBasicSetContainer(otherEnd, MappingPackage.FUNCTION_PAIR__MAPPER, msgs); 194 case MappingPackage.FUNCTION_PAIR__NESTED_IN: 195 if (eContainer != null) 196 msgs = eBasicRemoveFromContainer(msgs); 197 return eBasicSetContainer(otherEnd, MappingPackage.FUNCTION_PAIR__NESTED_IN, msgs); 198 case MappingPackage.FUNCTION_PAIR__NESTED: 199 return ((InternalEList)getNested()).basicAdd(otherEnd, msgs); 200 default: 201 return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); 202 } 203 } 204 if (eContainer != null) 205 msgs = eBasicRemoveFromContainer(msgs); 206 return eBasicSetContainer(otherEnd, featureID, msgs); 207 } 208 209 214 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 215 { 216 if (featureID >= 0) 217 { 218 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 219 { 220 case MappingPackage.FUNCTION_PAIR__MAPPER: 221 return eBasicSetContainer(null, MappingPackage.FUNCTION_PAIR__MAPPER, msgs); 222 case MappingPackage.FUNCTION_PAIR__NESTED_IN: 223 return eBasicSetContainer(null, MappingPackage.FUNCTION_PAIR__NESTED_IN, msgs); 224 case MappingPackage.FUNCTION_PAIR__NESTED: 225 return ((InternalEList)getNested()).basicRemove(otherEnd, msgs); 226 default: 227 return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); 228 } 229 } 230 return eBasicSetContainer(null, featureID, msgs); 231 } 232 233 238 public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) 239 { 240 if (eContainerFeatureID >= 0) 241 { 242 switch (eContainerFeatureID) 243 { 244 case MappingPackage.FUNCTION_PAIR__MAPPER: 245 return eContainer.eInverseRemove(this, MappingPackage.MAPPING__HELPER, Mapping.class, msgs); 246 case MappingPackage.FUNCTION_PAIR__NESTED_IN: 247 return eContainer.eInverseRemove(this, MappingPackage.MAPPING_HELPER__NESTED, MappingHelper.class, msgs); 248 default: 249 return eDynamicBasicRemoveFromContainer(msgs); 250 } 251 } 252 return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); 253 } 254 255 260 public Object eGet(EStructuralFeature eFeature, boolean resolve) 261 { 262 switch (eDerivedStructuralFeatureID(eFeature)) 263 { 264 case MappingPackage.FUNCTION_PAIR__MAPPER: 265 return getMapper(); 266 case MappingPackage.FUNCTION_PAIR__HELPED_OBJECT: 267 if (resolve) return getHelpedObject(); 268 return basicGetHelpedObject(); 269 case MappingPackage.FUNCTION_PAIR__NESTED_IN: 270 return getNestedIn(); 271 case MappingPackage.FUNCTION_PAIR__NESTED: 272 return getNested(); 273 case MappingPackage.FUNCTION_PAIR__IN2OUT: 274 if (resolve) return getIn2out(); 275 return basicGetIn2out(); 276 case MappingPackage.FUNCTION_PAIR__OUT2IN: 277 if (resolve) return getOut2in(); 278 return basicGetOut2in(); 279 } 280 return eDynamicGet(eFeature, resolve); 281 } 282 283 288 public void eSet(EStructuralFeature eFeature, Object newValue) 289 { 290 switch (eDerivedStructuralFeatureID(eFeature)) 291 { 292 case MappingPackage.FUNCTION_PAIR__MAPPER: 293 setMapper((Mapping)newValue); 294 return; 295 case MappingPackage.FUNCTION_PAIR__HELPED_OBJECT: 296 setHelpedObject((EObject)newValue); 297 return; 298 case MappingPackage.FUNCTION_PAIR__NESTED_IN: 299 setNestedIn((MappingHelper)newValue); 300 return; 301 case MappingPackage.FUNCTION_PAIR__NESTED: 302 getNested().clear(); 303 getNested().addAll((Collection )newValue); 304 return; 305 case MappingPackage.FUNCTION_PAIR__IN2OUT: 306 setIn2out((EOperation)newValue); 307 return; 308 case MappingPackage.FUNCTION_PAIR__OUT2IN: 309 setOut2in((EOperation)newValue); 310 return; 311 } 312 eDynamicSet(eFeature, newValue); 313 } 314 315 320 public void eUnset(EStructuralFeature eFeature) 321 { 322 switch (eDerivedStructuralFeatureID(eFeature)) 323 { 324 case MappingPackage.FUNCTION_PAIR__MAPPER: 325 setMapper((Mapping)null); 326 return; 327 case MappingPackage.FUNCTION_PAIR__HELPED_OBJECT: 328 setHelpedObject((EObject)null); 329 return; 330 case MappingPackage.FUNCTION_PAIR__NESTED_IN: 331 setNestedIn((MappingHelper)null); 332 return; 333 case MappingPackage.FUNCTION_PAIR__NESTED: 334 getNested().clear(); 335 return; 336 case MappingPackage.FUNCTION_PAIR__IN2OUT: 337 setIn2out((EOperation)null); 338 return; 339 case MappingPackage.FUNCTION_PAIR__OUT2IN: 340 setOut2in((EOperation)null); 341 return; 342 } 343 eDynamicUnset(eFeature); 344 } 345 346 351 public boolean eIsSet(EStructuralFeature eFeature) 352 { 353 switch (eDerivedStructuralFeatureID(eFeature)) 354 { 355 case MappingPackage.FUNCTION_PAIR__MAPPER: 356 return getMapper() != null; 357 case MappingPackage.FUNCTION_PAIR__HELPED_OBJECT: 358 return helpedObject != null; 359 case MappingPackage.FUNCTION_PAIR__NESTED_IN: 360 return getNestedIn() != null; 361 case MappingPackage.FUNCTION_PAIR__NESTED: 362 return nested != null && !nested.isEmpty(); 363 case MappingPackage.FUNCTION_PAIR__IN2OUT: 364 return in2out != null; 365 case MappingPackage.FUNCTION_PAIR__OUT2IN: 366 return out2in != null; 367 } 368 return eDynamicIsSet(eFeature); 369 } 370 371 } 373 374 | Popular Tags |