| /******************************************************************************* |
| * Copyright (c) 2009, 2016 Xored Software Inc and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Xored Software Inc - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package org.eclipse.rcptt.tesla.core.protocol.impl; |
| |
| import org.eclipse.rcptt.tesla.core.protocol.ProtocolPackage; |
| import org.eclipse.rcptt.tesla.core.protocol.RollbackToState; |
| |
| import org.eclipse.rcptt.tesla.core.protocol.raw.Element; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.EObjectImpl; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Rollback To State</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.RollbackToStateImpl#getId <em>Id</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.RollbackToStateImpl#getState <em>State</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class RollbackToStateImpl extends EObjectImpl implements RollbackToState { |
| /** |
| * The default value of the '{@link #getId() <em>Id</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected static final int ID_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getId() <em>Id</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected int id = ID_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getState() <em>State</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getState() |
| * @generated |
| * @ordered |
| */ |
| protected Element state; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected RollbackToStateImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ProtocolPackage.Literals.ROLLBACK_TO_STATE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getId() { |
| return id; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setId(int newId) { |
| int oldId = id; |
| id = newId; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.ROLLBACK_TO_STATE__ID, oldId, id)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Element getState() { |
| return state; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetState(Element newState, NotificationChain msgs) { |
| Element oldState = state; |
| state = newState; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ProtocolPackage.ROLLBACK_TO_STATE__STATE, oldState, newState); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setState(Element newState) { |
| if (newState != state) { |
| NotificationChain msgs = null; |
| if (state != null) |
| msgs = ((InternalEObject)state).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.ROLLBACK_TO_STATE__STATE, null, msgs); |
| if (newState != null) |
| msgs = ((InternalEObject)newState).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.ROLLBACK_TO_STATE__STATE, null, msgs); |
| msgs = basicSetState(newState, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.ROLLBACK_TO_STATE__STATE, newState, newState)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ProtocolPackage.ROLLBACK_TO_STATE__STATE: |
| return basicSetState(null, msgs); |
| } |
| return super.eInverseRemove(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case ProtocolPackage.ROLLBACK_TO_STATE__ID: |
| return getId(); |
| case ProtocolPackage.ROLLBACK_TO_STATE__STATE: |
| return getState(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ProtocolPackage.ROLLBACK_TO_STATE__ID: |
| setId((Integer)newValue); |
| return; |
| case ProtocolPackage.ROLLBACK_TO_STATE__STATE: |
| setState((Element)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ProtocolPackage.ROLLBACK_TO_STATE__ID: |
| setId(ID_EDEFAULT); |
| return; |
| case ProtocolPackage.ROLLBACK_TO_STATE__STATE: |
| setState((Element)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ProtocolPackage.ROLLBACK_TO_STATE__ID: |
| return id != ID_EDEFAULT; |
| case ProtocolPackage.ROLLBACK_TO_STATE__STATE: |
| return state != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuilder result = new StringBuilder(super.toString()); |
| result.append(" (id: "); |
| result.append(id); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //RollbackToStateImpl |