| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package de.uka.ipd.sdq.pcm.designdecision.GDoF.impl; |
| 8 | |
| 9 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.GDoFPackage; |
| 10 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.HelperOCLDefinition; |
| 11 | import de.uka.ipd.sdq.pcm.designdecision.GDoF.OCLRule; |
| 12 | |
| 13 | import java.util.Collection; |
| 14 | |
| 15 | import org.eclipse.emf.common.notify.Notification; |
| 16 | import org.eclipse.emf.common.notify.NotificationChain; |
| 17 | |
| 18 | import org.eclipse.emf.common.util.EList; |
| 19 | |
| 20 | import org.eclipse.emf.ecore.EClass; |
| 21 | import org.eclipse.emf.ecore.InternalEObject; |
| 22 | |
| 23 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 24 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
| 25 | |
| 26 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| 27 | import org.eclipse.emf.ecore.util.InternalEList; |
| 28 | |
| 29 | /** |
| 30 | * <!-- begin-user-doc --> |
| 31 | * An implementation of the model object '<em><b>OCL Rule</b></em>'. |
| 32 | * <!-- end-user-doc --> |
| 33 | * <p> |
| 34 | * The following features are implemented: |
| 35 | * <ul> |
| 36 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.GDoF.impl.OCLRuleImpl#getMainOclQuery <em>Main Ocl Query</em>}</li> |
| 37 | * <li>{@link de.uka.ipd.sdq.pcm.designdecision.GDoF.impl.OCLRuleImpl#getHelperDefinition <em>Helper Definition</em>}</li> |
| 38 | * </ul> |
| 39 | * </p> |
| 40 | * |
| 41 | * @generated |
| 42 | */ |
| 43 | public class OCLRuleImpl extends EObjectImpl implements OCLRule { |
| 44 | /** |
| 45 | * The default value of the '{@link #getMainOclQuery() <em>Main Ocl Query</em>}' attribute. |
| 46 | * <!-- begin-user-doc --> |
| 47 | * <!-- end-user-doc --> |
| 48 | * @see #getMainOclQuery() |
| 49 | * @generated |
| 50 | * @ordered |
| 51 | */ |
| 52 | protected static final String MAIN_OCL_QUERY_EDEFAULT = null; |
| 53 | |
| 54 | /** |
| 55 | * The cached value of the '{@link #getMainOclQuery() <em>Main Ocl Query</em>}' attribute. |
| 56 | * <!-- begin-user-doc --> |
| 57 | * <!-- end-user-doc --> |
| 58 | * @see #getMainOclQuery() |
| 59 | * @generated |
| 60 | * @ordered |
| 61 | */ |
| 62 | protected String mainOclQuery = MAIN_OCL_QUERY_EDEFAULT; |
| 63 | |
| 64 | /** |
| 65 | * The cached value of the '{@link #getHelperDefinition() <em>Helper Definition</em>}' containment reference list. |
| 66 | * <!-- begin-user-doc --> |
| 67 | * <!-- end-user-doc --> |
| 68 | * @see #getHelperDefinition() |
| 69 | * @generated |
| 70 | * @ordered |
| 71 | */ |
| 72 | protected EList<HelperOCLDefinition> helperDefinition; |
| 73 | |
| 74 | /** |
| 75 | * <!-- begin-user-doc --> |
| 76 | * <!-- end-user-doc --> |
| 77 | * @generated |
| 78 | */ |
| 79 | protected OCLRuleImpl() { |
| 80 | super(); |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * <!-- begin-user-doc --> |
| 85 | * <!-- end-user-doc --> |
| 86 | * @generated |
| 87 | */ |
| 88 | @Override |
| 89 | protected EClass eStaticClass() { |
| 90 | return GDoFPackage.Literals.OCL_RULE; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * <!-- begin-user-doc --> |
| 95 | * <!-- end-user-doc --> |
| 96 | * @generated |
| 97 | */ |
| 98 | public String getMainOclQuery() { |
| 99 | return mainOclQuery; |
| 100 | } |
| 101 | |
| 102 | /** |
| 103 | * <!-- begin-user-doc --> |
| 104 | * <!-- end-user-doc --> |
| 105 | * @generated |
| 106 | */ |
| 107 | public void setMainOclQuery(String newMainOclQuery) { |
| 108 | String oldMainOclQuery = mainOclQuery; |
| 109 | mainOclQuery = newMainOclQuery; |
| 110 | if (eNotificationRequired()) |
| 111 | eNotify(new ENotificationImpl(this, Notification.SET, GDoFPackage.OCL_RULE__MAIN_OCL_QUERY, oldMainOclQuery, mainOclQuery)); |
| 112 | } |
| 113 | |
| 114 | /** |
| 115 | * <!-- begin-user-doc --> |
| 116 | * <!-- end-user-doc --> |
| 117 | * @generated |
| 118 | */ |
| 119 | public EList<HelperOCLDefinition> getHelperDefinition() { |
| 120 | if (helperDefinition == null) { |
| 121 | helperDefinition = new EObjectContainmentEList<HelperOCLDefinition>(HelperOCLDefinition.class, this, GDoFPackage.OCL_RULE__HELPER_DEFINITION); |
| 122 | } |
| 123 | return helperDefinition; |
| 124 | } |
| 125 | |
| 126 | /** |
| 127 | * <!-- begin-user-doc --> |
| 128 | * <!-- end-user-doc --> |
| 129 | * @generated |
| 130 | */ |
| 131 | @Override |
| 132 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 133 | switch (featureID) { |
| 134 | case GDoFPackage.OCL_RULE__HELPER_DEFINITION: |
| 135 | return ((InternalEList<?>)getHelperDefinition()).basicRemove(otherEnd, msgs); |
| 136 | } |
| 137 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * <!-- begin-user-doc --> |
| 142 | * <!-- end-user-doc --> |
| 143 | * @generated |
| 144 | */ |
| 145 | @Override |
| 146 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 147 | switch (featureID) { |
| 148 | case GDoFPackage.OCL_RULE__MAIN_OCL_QUERY: |
| 149 | return getMainOclQuery(); |
| 150 | case GDoFPackage.OCL_RULE__HELPER_DEFINITION: |
| 151 | return getHelperDefinition(); |
| 152 | } |
| 153 | return super.eGet(featureID, resolve, coreType); |
| 154 | } |
| 155 | |
| 156 | /** |
| 157 | * <!-- begin-user-doc --> |
| 158 | * <!-- end-user-doc --> |
| 159 | * @generated |
| 160 | */ |
| 161 | @SuppressWarnings("unchecked") |
| 162 | @Override |
| 163 | public void eSet(int featureID, Object newValue) { |
| 164 | switch (featureID) { |
| 165 | case GDoFPackage.OCL_RULE__MAIN_OCL_QUERY: |
| 166 | setMainOclQuery((String)newValue); |
| 167 | return; |
| 168 | case GDoFPackage.OCL_RULE__HELPER_DEFINITION: |
| 169 | getHelperDefinition().clear(); |
| 170 | getHelperDefinition().addAll((Collection<? extends HelperOCLDefinition>)newValue); |
| 171 | return; |
| 172 | } |
| 173 | super.eSet(featureID, newValue); |
| 174 | } |
| 175 | |
| 176 | /** |
| 177 | * <!-- begin-user-doc --> |
| 178 | * <!-- end-user-doc --> |
| 179 | * @generated |
| 180 | */ |
| 181 | @Override |
| 182 | public void eUnset(int featureID) { |
| 183 | switch (featureID) { |
| 184 | case GDoFPackage.OCL_RULE__MAIN_OCL_QUERY: |
| 185 | setMainOclQuery(MAIN_OCL_QUERY_EDEFAULT); |
| 186 | return; |
| 187 | case GDoFPackage.OCL_RULE__HELPER_DEFINITION: |
| 188 | getHelperDefinition().clear(); |
| 189 | return; |
| 190 | } |
| 191 | super.eUnset(featureID); |
| 192 | } |
| 193 | |
| 194 | /** |
| 195 | * <!-- begin-user-doc --> |
| 196 | * <!-- end-user-doc --> |
| 197 | * @generated |
| 198 | */ |
| 199 | @Override |
| 200 | public boolean eIsSet(int featureID) { |
| 201 | switch (featureID) { |
| 202 | case GDoFPackage.OCL_RULE__MAIN_OCL_QUERY: |
| 203 | return MAIN_OCL_QUERY_EDEFAULT == null ? mainOclQuery != null : !MAIN_OCL_QUERY_EDEFAULT.equals(mainOclQuery); |
| 204 | case GDoFPackage.OCL_RULE__HELPER_DEFINITION: |
| 205 | return helperDefinition != null && !helperDefinition.isEmpty(); |
| 206 | } |
| 207 | return super.eIsSet(featureID); |
| 208 | } |
| 209 | |
| 210 | /** |
| 211 | * <!-- begin-user-doc --> |
| 212 | * <!-- end-user-doc --> |
| 213 | * @generated |
| 214 | */ |
| 215 | @Override |
| 216 | public String toString() { |
| 217 | if (eIsProxy()) return super.toString(); |
| 218 | |
| 219 | StringBuffer result = new StringBuffer(super.toString()); |
| 220 | result.append(" (mainOclQuery: "); |
| 221 | result.append(mainOclQuery); |
| 222 | result.append(')'); |
| 223 | return result.toString(); |
| 224 | } |
| 225 | |
| 226 | } //OCLRuleImpl |