| 1 | /** |
| 2 | * <copyright> |
| 3 | * </copyright> |
| 4 | * |
| 5 | * $Id$ |
| 6 | */ |
| 7 | package LqnCore.impl; |
| 8 | |
| 9 | import LqnCore.ActivityMakingCallType; |
| 10 | import LqnCore.ActivityPhasesType; |
| 11 | import LqnCore.CallListType; |
| 12 | import LqnCore.LqnCorePackage; |
| 13 | |
| 14 | import java.math.BigInteger; |
| 15 | |
| 16 | import java.util.Collection; |
| 17 | |
| 18 | import org.eclipse.emf.common.notify.Notification; |
| 19 | import org.eclipse.emf.common.notify.NotificationChain; |
| 20 | |
| 21 | import org.eclipse.emf.common.util.EList; |
| 22 | |
| 23 | import org.eclipse.emf.ecore.EClass; |
| 24 | import org.eclipse.emf.ecore.InternalEObject; |
| 25 | |
| 26 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| 27 | |
| 28 | import org.eclipse.emf.ecore.util.BasicFeatureMap; |
| 29 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| 30 | import org.eclipse.emf.ecore.util.FeatureMap; |
| 31 | import org.eclipse.emf.ecore.util.InternalEList; |
| 32 | |
| 33 | /** |
| 34 | * <!-- begin-user-doc --> |
| 35 | * An implementation of the model object '<em><b>Activity Phases Type</b></em>'. |
| 36 | * <!-- end-user-doc --> |
| 37 | * <p> |
| 38 | * The following features are implemented: |
| 39 | * <ul> |
| 40 | * <li>{@link LqnCore.impl.ActivityPhasesTypeImpl#getCallList <em>Call List</em>}</li> |
| 41 | * <li>{@link LqnCore.impl.ActivityPhasesTypeImpl#getGroup <em>Group</em>}</li> |
| 42 | * <li>{@link LqnCore.impl.ActivityPhasesTypeImpl#getSynchCall <em>Synch Call</em>}</li> |
| 43 | * <li>{@link LqnCore.impl.ActivityPhasesTypeImpl#getAsynchCall <em>Asynch Call</em>}</li> |
| 44 | * <li>{@link LqnCore.impl.ActivityPhasesTypeImpl#getPhase <em>Phase</em>}</li> |
| 45 | * </ul> |
| 46 | * </p> |
| 47 | * |
| 48 | * @generated |
| 49 | */ |
| 50 | public class ActivityPhasesTypeImpl extends ActivityDefBaseImpl implements ActivityPhasesType { |
| 51 | /** |
| 52 | * The cached value of the '{@link #getCallList() <em>Call List</em>}' containment reference list. |
| 53 | * <!-- begin-user-doc --> |
| 54 | * <!-- end-user-doc --> |
| 55 | * @see #getCallList() |
| 56 | * @generated |
| 57 | * @ordered |
| 58 | */ |
| 59 | protected EList<CallListType> callList; |
| 60 | |
| 61 | /** |
| 62 | * The cached value of the '{@link #getGroup() <em>Group</em>}' attribute list. |
| 63 | * <!-- begin-user-doc --> |
| 64 | * <!-- end-user-doc --> |
| 65 | * @see #getGroup() |
| 66 | * @generated |
| 67 | * @ordered |
| 68 | */ |
| 69 | protected FeatureMap group; |
| 70 | |
| 71 | /** |
| 72 | * The default value of the '{@link #getPhase() <em>Phase</em>}' attribute. |
| 73 | * <!-- begin-user-doc --> |
| 74 | * <!-- end-user-doc --> |
| 75 | * @see #getPhase() |
| 76 | * @generated |
| 77 | * @ordered |
| 78 | */ |
| 79 | protected static final BigInteger PHASE_EDEFAULT = null; |
| 80 | |
| 81 | /** |
| 82 | * The cached value of the '{@link #getPhase() <em>Phase</em>}' attribute. |
| 83 | * <!-- begin-user-doc --> |
| 84 | * <!-- end-user-doc --> |
| 85 | * @see #getPhase() |
| 86 | * @generated |
| 87 | * @ordered |
| 88 | */ |
| 89 | protected BigInteger phase = PHASE_EDEFAULT; |
| 90 | |
| 91 | /** |
| 92 | * <!-- begin-user-doc --> |
| 93 | * <!-- end-user-doc --> |
| 94 | * @generated |
| 95 | */ |
| 96 | protected ActivityPhasesTypeImpl() { |
| 97 | super(); |
| 98 | } |
| 99 | |
| 100 | /** |
| 101 | * <!-- begin-user-doc --> |
| 102 | * <!-- end-user-doc --> |
| 103 | * @generated |
| 104 | */ |
| 105 | @Override |
| 106 | protected EClass eStaticClass() { |
| 107 | return LqnCorePackage.Literals.ACTIVITY_PHASES_TYPE; |
| 108 | } |
| 109 | |
| 110 | /** |
| 111 | * <!-- begin-user-doc --> |
| 112 | * <!-- end-user-doc --> |
| 113 | * @generated |
| 114 | */ |
| 115 | public EList<CallListType> getCallList() { |
| 116 | if (callList == null) { |
| 117 | callList = new EObjectContainmentEList<CallListType>(CallListType.class, this, LqnCorePackage.ACTIVITY_PHASES_TYPE__CALL_LIST); |
| 118 | } |
| 119 | return callList; |
| 120 | } |
| 121 | |
| 122 | /** |
| 123 | * <!-- begin-user-doc --> |
| 124 | * <!-- end-user-doc --> |
| 125 | * @generated |
| 126 | */ |
| 127 | public FeatureMap getGroup() { |
| 128 | if (group == null) { |
| 129 | group = new BasicFeatureMap(this, LqnCorePackage.ACTIVITY_PHASES_TYPE__GROUP); |
| 130 | } |
| 131 | return group; |
| 132 | } |
| 133 | |
| 134 | /** |
| 135 | * <!-- begin-user-doc --> |
| 136 | * <!-- end-user-doc --> |
| 137 | * @generated |
| 138 | */ |
| 139 | public EList<ActivityMakingCallType> getSynchCall() { |
| 140 | return getGroup().list(LqnCorePackage.Literals.ACTIVITY_PHASES_TYPE__SYNCH_CALL); |
| 141 | } |
| 142 | |
| 143 | /** |
| 144 | * <!-- begin-user-doc --> |
| 145 | * <!-- end-user-doc --> |
| 146 | * @generated |
| 147 | */ |
| 148 | public EList<ActivityMakingCallType> getAsynchCall() { |
| 149 | return getGroup().list(LqnCorePackage.Literals.ACTIVITY_PHASES_TYPE__ASYNCH_CALL); |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * <!-- begin-user-doc --> |
| 154 | * <!-- end-user-doc --> |
| 155 | * @generated |
| 156 | */ |
| 157 | public BigInteger getPhase() { |
| 158 | return phase; |
| 159 | } |
| 160 | |
| 161 | /** |
| 162 | * <!-- begin-user-doc --> |
| 163 | * <!-- end-user-doc --> |
| 164 | * @generated |
| 165 | */ |
| 166 | public void setPhase(BigInteger newPhase) { |
| 167 | BigInteger oldPhase = phase; |
| 168 | phase = newPhase; |
| 169 | if (eNotificationRequired()) |
| 170 | eNotify(new ENotificationImpl(this, Notification.SET, LqnCorePackage.ACTIVITY_PHASES_TYPE__PHASE, oldPhase, phase)); |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * <!-- begin-user-doc --> |
| 175 | * <!-- end-user-doc --> |
| 176 | * @generated |
| 177 | */ |
| 178 | @Override |
| 179 | public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| 180 | switch (featureID) { |
| 181 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__CALL_LIST: |
| 182 | return ((InternalEList<?>)getCallList()).basicRemove(otherEnd, msgs); |
| 183 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__GROUP: |
| 184 | return ((InternalEList<?>)getGroup()).basicRemove(otherEnd, msgs); |
| 185 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__SYNCH_CALL: |
| 186 | return ((InternalEList<?>)getSynchCall()).basicRemove(otherEnd, msgs); |
| 187 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__ASYNCH_CALL: |
| 188 | return ((InternalEList<?>)getAsynchCall()).basicRemove(otherEnd, msgs); |
| 189 | } |
| 190 | return super.eInverseRemove(otherEnd, featureID, msgs); |
| 191 | } |
| 192 | |
| 193 | /** |
| 194 | * <!-- begin-user-doc --> |
| 195 | * <!-- end-user-doc --> |
| 196 | * @generated |
| 197 | */ |
| 198 | @Override |
| 199 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| 200 | switch (featureID) { |
| 201 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__CALL_LIST: |
| 202 | return getCallList(); |
| 203 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__GROUP: |
| 204 | if (coreType) return getGroup(); |
| 205 | return ((FeatureMap.Internal)getGroup()).getWrapper(); |
| 206 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__SYNCH_CALL: |
| 207 | return getSynchCall(); |
| 208 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__ASYNCH_CALL: |
| 209 | return getAsynchCall(); |
| 210 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__PHASE: |
| 211 | return getPhase(); |
| 212 | } |
| 213 | return super.eGet(featureID, resolve, coreType); |
| 214 | } |
| 215 | |
| 216 | /** |
| 217 | * <!-- begin-user-doc --> |
| 218 | * <!-- end-user-doc --> |
| 219 | * @generated |
| 220 | */ |
| 221 | @SuppressWarnings("unchecked") |
| 222 | @Override |
| 223 | public void eSet(int featureID, Object newValue) { |
| 224 | switch (featureID) { |
| 225 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__CALL_LIST: |
| 226 | getCallList().clear(); |
| 227 | getCallList().addAll((Collection<? extends CallListType>)newValue); |
| 228 | return; |
| 229 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__GROUP: |
| 230 | ((FeatureMap.Internal)getGroup()).set(newValue); |
| 231 | return; |
| 232 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__SYNCH_CALL: |
| 233 | getSynchCall().clear(); |
| 234 | getSynchCall().addAll((Collection<? extends ActivityMakingCallType>)newValue); |
| 235 | return; |
| 236 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__ASYNCH_CALL: |
| 237 | getAsynchCall().clear(); |
| 238 | getAsynchCall().addAll((Collection<? extends ActivityMakingCallType>)newValue); |
| 239 | return; |
| 240 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__PHASE: |
| 241 | setPhase((BigInteger)newValue); |
| 242 | return; |
| 243 | } |
| 244 | super.eSet(featureID, newValue); |
| 245 | } |
| 246 | |
| 247 | /** |
| 248 | * <!-- begin-user-doc --> |
| 249 | * <!-- end-user-doc --> |
| 250 | * @generated |
| 251 | */ |
| 252 | @Override |
| 253 | public void eUnset(int featureID) { |
| 254 | switch (featureID) { |
| 255 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__CALL_LIST: |
| 256 | getCallList().clear(); |
| 257 | return; |
| 258 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__GROUP: |
| 259 | getGroup().clear(); |
| 260 | return; |
| 261 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__SYNCH_CALL: |
| 262 | getSynchCall().clear(); |
| 263 | return; |
| 264 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__ASYNCH_CALL: |
| 265 | getAsynchCall().clear(); |
| 266 | return; |
| 267 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__PHASE: |
| 268 | setPhase(PHASE_EDEFAULT); |
| 269 | return; |
| 270 | } |
| 271 | super.eUnset(featureID); |
| 272 | } |
| 273 | |
| 274 | /** |
| 275 | * <!-- begin-user-doc --> |
| 276 | * <!-- end-user-doc --> |
| 277 | * @generated |
| 278 | */ |
| 279 | @Override |
| 280 | public boolean eIsSet(int featureID) { |
| 281 | switch (featureID) { |
| 282 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__CALL_LIST: |
| 283 | return callList != null && !callList.isEmpty(); |
| 284 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__GROUP: |
| 285 | return group != null && !group.isEmpty(); |
| 286 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__SYNCH_CALL: |
| 287 | return !getSynchCall().isEmpty(); |
| 288 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__ASYNCH_CALL: |
| 289 | return !getAsynchCall().isEmpty(); |
| 290 | case LqnCorePackage.ACTIVITY_PHASES_TYPE__PHASE: |
| 291 | return PHASE_EDEFAULT == null ? phase != null : !PHASE_EDEFAULT.equals(phase); |
| 292 | } |
| 293 | return super.eIsSet(featureID); |
| 294 | } |
| 295 | |
| 296 | /** |
| 297 | * <!-- begin-user-doc --> |
| 298 | * <!-- end-user-doc --> |
| 299 | * @generated |
| 300 | */ |
| 301 | @Override |
| 302 | public String toString() { |
| 303 | if (eIsProxy()) return super.toString(); |
| 304 | |
| 305 | StringBuffer result = new StringBuffer(super.toString()); |
| 306 | result.append(" (group: "); |
| 307 | result.append(group); |
| 308 | result.append(", phase: "); |
| 309 | result.append(phase); |
| 310 | result.append(')'); |
| 311 | return result.toString(); |
| 312 | } |
| 313 | |
| 314 | } //ActivityPhasesTypeImpl |