1 17 package org.eclipse.emf.ecore.impl; 18 19 20 import java.util.Collection ; 21 22 import org.eclipse.emf.common.notify.NotificationChain; 23 import org.eclipse.emf.ecore.EClass; 24 import org.eclipse.emf.ecore.EClassifier; 25 import org.eclipse.emf.ecore.EOperation; 26 import org.eclipse.emf.ecore.EParameter; 27 import org.eclipse.emf.ecore.EStructuralFeature; 28 import org.eclipse.emf.ecore.EcorePackage; 29 import org.eclipse.emf.ecore.InternalEObject; 30 import org.eclipse.emf.ecore.util.InternalEList; 31 32 33 46 public class EParameterImpl extends ETypedElementImpl implements EParameter 47 { 48 53 protected EParameterImpl() 54 { 55 super(); 56 } 57 58 63 protected EClass eStaticClass() 64 { 65 return EcorePackage.eINSTANCE.getEParameter(); 66 } 67 68 73 public EOperation getEOperation() 74 { 75 return (eContainerFeatureID == EcorePackage.EPARAMETER__EOPERATION) ? (EOperation)eContainer : null; 76 } 77 78 83 public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 84 { 85 if (featureID >= 0) 86 { 87 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 88 { 89 case EcorePackage.EPARAMETER__EANNOTATIONS: 90 return ((InternalEList)getEAnnotations()).basicAdd(otherEnd, msgs); 91 case EcorePackage.EPARAMETER__EOPERATION: 92 if (eContainer != null) 93 msgs = eBasicRemoveFromContainer(msgs); 94 return eBasicSetContainer(otherEnd, EcorePackage.EPARAMETER__EOPERATION, 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 109 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, Class baseClass, NotificationChain msgs) 110 { 111 if (featureID >= 0) 112 { 113 switch (eDerivedStructuralFeatureID(featureID, baseClass)) 114 { 115 case EcorePackage.EPARAMETER__EANNOTATIONS: 116 return ((InternalEList)getEAnnotations()).basicRemove(otherEnd, msgs); 117 case EcorePackage.EPARAMETER__EOPERATION: 118 return eBasicSetContainer(null, EcorePackage.EPARAMETER__EOPERATION, msgs); 119 default: 120 return eDynamicInverseRemove(otherEnd, featureID, baseClass, msgs); 121 } 122 } 123 return eBasicSetContainer(null, featureID, msgs); 124 } 125 126 131 public NotificationChain eBasicRemoveFromContainer(NotificationChain msgs) 132 { 133 if (eContainerFeatureID >= 0) 134 { 135 switch (eContainerFeatureID) 136 { 137 case EcorePackage.EPARAMETER__EOPERATION: 138 return eContainer.eInverseRemove(this, EcorePackage.EOPERATION__EPARAMETERS, EOperation.class, msgs); 139 default: 140 return eDynamicBasicRemoveFromContainer(msgs); 141 } 142 } 143 return eContainer.eInverseRemove(this, EOPPOSITE_FEATURE_BASE - eContainerFeatureID, null, msgs); 144 } 145 146 151 public Object eGet(EStructuralFeature eFeature, boolean resolve) 152 { 153 switch (eDerivedStructuralFeatureID(eFeature)) 154 { 155 case EcorePackage.EPARAMETER__EANNOTATIONS: 156 return getEAnnotations(); 157 case EcorePackage.EPARAMETER__NAME: 158 return getName(); 159 case EcorePackage.EPARAMETER__ORDERED: 160 return isOrdered() ? Boolean.TRUE : Boolean.FALSE; 161 case EcorePackage.EPARAMETER__UNIQUE: 162 return isUnique() ? Boolean.TRUE : Boolean.FALSE; 163 case EcorePackage.EPARAMETER__LOWER_BOUND: 164 return new Integer (getLowerBound()); 165 case EcorePackage.EPARAMETER__UPPER_BOUND: 166 return new Integer (getUpperBound()); 167 case EcorePackage.EPARAMETER__MANY: 168 return isMany() ? Boolean.TRUE : Boolean.FALSE; 169 case EcorePackage.EPARAMETER__REQUIRED: 170 return isRequired() ? Boolean.TRUE : Boolean.FALSE; 171 case EcorePackage.EPARAMETER__ETYPE: 172 if (resolve) return getEType(); 173 return basicGetEType(); 174 case EcorePackage.EPARAMETER__EOPERATION: 175 return getEOperation(); 176 } 177 return eDynamicGet(eFeature, resolve); 178 } 179 180 185 public boolean eIsSet(EStructuralFeature eFeature) 186 { 187 switch (eDerivedStructuralFeatureID(eFeature)) 188 { 189 case EcorePackage.EPARAMETER__EANNOTATIONS: 190 return eAnnotations != null && !eAnnotations.isEmpty(); 191 case EcorePackage.EPARAMETER__NAME: 192 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); 193 case EcorePackage.EPARAMETER__ORDERED: 194 return ((eFlags & ORDERED_EFLAG) != 0) != ORDERED_EDEFAULT; 195 case EcorePackage.EPARAMETER__UNIQUE: 196 return ((eFlags & UNIQUE_EFLAG) != 0) != UNIQUE_EDEFAULT; 197 case EcorePackage.EPARAMETER__LOWER_BOUND: 198 return lowerBound != LOWER_BOUND_EDEFAULT; 199 case EcorePackage.EPARAMETER__UPPER_BOUND: 200 return upperBound != UPPER_BOUND_EDEFAULT; 201 case EcorePackage.EPARAMETER__MANY: 202 return isMany() != MANY_EDEFAULT; 203 case EcorePackage.EPARAMETER__REQUIRED: 204 return isRequired() != REQUIRED_EDEFAULT; 205 case EcorePackage.EPARAMETER__ETYPE: 206 return eType != null; 207 case EcorePackage.EPARAMETER__EOPERATION: 208 return getEOperation() != null; 209 } 210 return eDynamicIsSet(eFeature); 211 } 212 213 218 public void eSet(EStructuralFeature eFeature, Object newValue) 219 { 220 switch (eDerivedStructuralFeatureID(eFeature)) 221 { 222 case EcorePackage.EPARAMETER__EANNOTATIONS: 223 getEAnnotations().clear(); 224 getEAnnotations().addAll((Collection )newValue); 225 return; 226 case EcorePackage.EPARAMETER__NAME: 227 setName((String )newValue); 228 return; 229 case EcorePackage.EPARAMETER__ORDERED: 230 setOrdered(((Boolean )newValue).booleanValue()); 231 return; 232 case EcorePackage.EPARAMETER__UNIQUE: 233 setUnique(((Boolean )newValue).booleanValue()); 234 return; 235 case EcorePackage.EPARAMETER__LOWER_BOUND: 236 setLowerBound(((Integer )newValue).intValue()); 237 return; 238 case EcorePackage.EPARAMETER__UPPER_BOUND: 239 setUpperBound(((Integer )newValue).intValue()); 240 return; 241 case EcorePackage.EPARAMETER__ETYPE: 242 setEType((EClassifier)newValue); 243 return; 244 } 245 eDynamicSet(eFeature, newValue); 246 } 247 248 253 public void eUnset(EStructuralFeature eFeature) 254 { 255 switch (eDerivedStructuralFeatureID(eFeature)) 256 { 257 case EcorePackage.EPARAMETER__EANNOTATIONS: 258 getEAnnotations().clear(); 259 return; 260 case EcorePackage.EPARAMETER__NAME: 261 setName(NAME_EDEFAULT); 262 return; 263 case EcorePackage.EPARAMETER__ORDERED: 264 setOrdered(ORDERED_EDEFAULT); 265 return; 266 case EcorePackage.EPARAMETER__UNIQUE: 267 setUnique(UNIQUE_EDEFAULT); 268 return; 269 case EcorePackage.EPARAMETER__LOWER_BOUND: 270 setLowerBound(LOWER_BOUND_EDEFAULT); 271 return; 272 case EcorePackage.EPARAMETER__UPPER_BOUND: 273 setUpperBound(UPPER_BOUND_EDEFAULT); 274 return; 275 case EcorePackage.EPARAMETER__ETYPE: 276 setEType((EClassifier)null); 277 return; 278 } 279 eDynamicUnset(eFeature); 280 } 281 282 } | Popular Tags |