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.EStructuralFeature; 27 import org.eclipse.emf.ecore.InternalEObject; 28 import org.eclipse.emf.ecore.impl.ENotificationImpl; 29 import org.eclipse.emf.ecore.util.InternalEList; 30 import org.eclipse.emf.mapping.FunctionNamePair; 31 import org.eclipse.emf.mapping.Mapping; 32 import org.eclipse.emf.mapping.MappingHelper; 33 import org.eclipse.emf.mapping.MappingPackage; 34 35 36 50 public class FunctionNamePairImpl extends TypeConverterImpl implements FunctionNamePair 51 { 52 60 protected static final String IN2OUT_EDEFAULT = null; 61 62 70 protected String in2out = IN2OUT_EDEFAULT; 71 72 80 protected static final String OUT2IN_EDEFAULT = null; 81 82 90 protected String out2in = OUT2IN_EDEFAULT; 91 92 97 protected FunctionNamePairImpl() 98 { 99 super(); 100 } 101 102 107 protected EClass eStaticClass() 108 { 109 return MappingPackage.eINSTANCE.getFunctionNamePair(); 110 } 111 112 117 public String getIn2out() 118 { 119 return in2out; 120 } 121 122 127 public void setIn2out(String newIn2out) 128 { 129 String oldIn2out = in2out; 130 in2out = newIn2out; 131 if (eNotificationRequired()) 132 eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.FUNCTION_NAME_PAIR__IN2OUT, oldIn2out, in2out)); 133 } 134 135 140 public String getOut2in() 141 { 142 return out2in; 143 } 144 145 150 public void setOut2in(String newOut2in) 151 { 152 String oldOut2in = out2in; 153 out2in = newOut2in; 154 if (eNotificationRequired()) 155 eNotify(new ENotificationImpl(this, Notification.SET, MappingPackage.FUNCTION_NAME_PAIR__OUT2IN, oldOut2in, out2in)); 156 } 157 158 163 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 164 { 165 if (featureID >= 0) 166 { 167 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 168 { 169 case MappingPackage.FUNCTION_NAME_PAIR__MAPPER: 170 if (eContainer != null) 171 msgs = eBasicRemoveFromContainer(msgs); 172 return eBasicSetContainer(otherEnd, MappingPackage.FUNCTION_NAME_PAIR__MAPPER, msgs); 173 case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN: 174 if (eContainer != null) 175 msgs = eBasicRemoveFromContainer(msgs); 176 return eBasicSetContainer(otherEnd, MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN, msgs); 177 case MappingPackage.FUNCTION_NAME_PAIR__NESTED: 178 return ((InternalEList)getNested()).basicAdd(otherEnd, msgs); 179 default: 180 return eDynamicInverseAdd(otherEnd, featureID, baseClass, msgs); 181 } 182 } 183 if (eContainer != null) 184 msgs = eBasicRemoveFromContainer(msgs); 185 return eBasicSetContainer(otherEnd, featureID, msgs); 186 } 187 188 193 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 194 { 195 if (featureID >= 0) 196 { 197 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 198 { 199 case MappingPackage.FUNCTION_NAME_PAIR__MAPPER: 200 return eBasicSetContainer(null, MappingPackage.FUNCTION_NAME_PAIR__MAPPER, msgs); 201 case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN: 202 return eBasicSetContainer(null, MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN, msgs); 203 case MappingPackage.FUNCTION_NAME_PAIR__NESTED: 204 return ((InternalEList)getNested()).basicRemove(otherEnd, msgs); 205 default: 206 return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); 207 } 208 } 209 return eBasicSetContainer(null, featureID, msgs); 210 } 211 212 217 public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) 218 { 219 if (eContainerFeatureID >= 0) 220 { 221 switch (eContainerFeatureID) 222 { 223 case MappingPackage.FUNCTION_NAME_PAIR__MAPPER: 224 return eContainer.eInverseRemove(this, MappingPackage.MAPPING__HELPER, Mapping.class, msgs); 225 case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN: 226 return eContainer.eInverseRemove(this, MappingPackage.MAPPING_HELPER__NESTED, MappingHelper.class, msgs); 227 default: 228 return eDynamicBasicRemoveFromContainer(msgs); 229 } 230 } 231 return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); 232 } 233 234 239 public Object eGet(EStructuralFeature eFeature, boolean resolve) 240 { 241 switch (eDerivedStructuralFeatureID(eFeature)) 242 { 243 case MappingPackage.FUNCTION_NAME_PAIR__MAPPER: 244 return getMapper(); 245 case MappingPackage.FUNCTION_NAME_PAIR__HELPED_OBJECT: 246 if (resolve) return getHelpedObject(); 247 return basicGetHelpedObject(); 248 case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN: 249 return getNestedIn(); 250 case MappingPackage.FUNCTION_NAME_PAIR__NESTED: 251 return getNested(); 252 case MappingPackage.FUNCTION_NAME_PAIR__IN2OUT: 253 return getIn2out(); 254 case MappingPackage.FUNCTION_NAME_PAIR__OUT2IN: 255 return getOut2in(); 256 } 257 return eDynamicGet(eFeature, resolve); 258 } 259 260 265 public void eSet(EStructuralFeature eFeature, Object newValue) 266 { 267 switch (eDerivedStructuralFeatureID(eFeature)) 268 { 269 case MappingPackage.FUNCTION_NAME_PAIR__MAPPER: 270 setMapper((Mapping)newValue); 271 return; 272 case MappingPackage.FUNCTION_NAME_PAIR__HELPED_OBJECT: 273 setHelpedObject((EObject)newValue); 274 return; 275 case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN: 276 setNestedIn((MappingHelper)newValue); 277 return; 278 case MappingPackage.FUNCTION_NAME_PAIR__NESTED: 279 getNested().clear(); 280 getNested().addAll((Collection )newValue); 281 return; 282 case MappingPackage.FUNCTION_NAME_PAIR__IN2OUT: 283 setIn2out((String )newValue); 284 return; 285 case MappingPackage.FUNCTION_NAME_PAIR__OUT2IN: 286 setOut2in((String )newValue); 287 return; 288 } 289 eDynamicSet(eFeature, newValue); 290 } 291 292 297 public void eUnset(EStructuralFeature eFeature) 298 { 299 switch (eDerivedStructuralFeatureID(eFeature)) 300 { 301 case MappingPackage.FUNCTION_NAME_PAIR__MAPPER: 302 setMapper((Mapping)null); 303 return; 304 case MappingPackage.FUNCTION_NAME_PAIR__HELPED_OBJECT: 305 setHelpedObject((EObject)null); 306 return; 307 case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN: 308 setNestedIn((MappingHelper)null); 309 return; 310 case MappingPackage.FUNCTION_NAME_PAIR__NESTED: 311 getNested().clear(); 312 return; 313 case MappingPackage.FUNCTION_NAME_PAIR__IN2OUT: 314 setIn2out(IN2OUT_EDEFAULT); 315 return; 316 case MappingPackage.FUNCTION_NAME_PAIR__OUT2IN: 317 setOut2in(OUT2IN_EDEFAULT); 318 return; 319 } 320 eDynamicUnset(eFeature); 321 } 322 323 328 public boolean eIsSet(EStructuralFeature eFeature) 329 { 330 switch (eDerivedStructuralFeatureID(eFeature)) 331 { 332 case MappingPackage.FUNCTION_NAME_PAIR__MAPPER: 333 return getMapper() != null; 334 case MappingPackage.FUNCTION_NAME_PAIR__HELPED_OBJECT: 335 return helpedObject != null; 336 case MappingPackage.FUNCTION_NAME_PAIR__NESTED_IN: 337 return getNestedIn() != null; 338 case MappingPackage.FUNCTION_NAME_PAIR__NESTED: 339 return nested != null && !nested.isEmpty(); 340 case MappingPackage.FUNCTION_NAME_PAIR__IN2OUT: 341 return IN2OUT_EDEFAULT == null ? in2out != null : !IN2OUT_EDEFAULT.equals(in2out); 342 case MappingPackage.FUNCTION_NAME_PAIR__OUT2IN: 343 return OUT2IN_EDEFAULT == null ? out2in != null : !OUT2IN_EDEFAULT.equals(out2in); 344 } 345 return eDynamicIsSet(eFeature); 346 } 347 348 353 public String toString() 354 { 355 if (eIsProxy()) return super.toString(); 356 357 StringBuffer result = new StringBuffer (super.toString()); 358 result.append(" (in2out: "); 359 result.append(in2out); 360 result.append(", out2in: "); 361 result.append(out2in); 362 result.append(')'); 363 return result.toString(); 364 } 365 366 } | Popular Tags |