| /******************************************************************************* |
| * Copyright (c) 2014 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.diagram.impl; |
| |
| 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; |
| |
| import org.eclipse.rcptt.tesla.core.protocol.diagram.CreateConnection; |
| import org.eclipse.rcptt.tesla.core.protocol.diagram.DiagramPackage; |
| |
| import org.eclipse.rcptt.tesla.core.protocol.raw.Element; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Create Connection</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.diagram.impl.CreateConnectionImpl#getId <em>Id</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.diagram.impl.CreateConnectionImpl#getElement <em>Element</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.diagram.impl.CreateConnectionImpl#getPattern <em>Pattern</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.diagram.impl.CreateConnectionImpl#getFrom <em>From</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.diagram.impl.CreateConnectionImpl#getTo <em>To</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class CreateConnectionImpl extends EObjectImpl implements CreateConnection { |
| /** |
| * 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 #getElement() <em>Element</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getElement() |
| * @generated |
| * @ordered |
| */ |
| protected Element element; |
| |
| /** |
| * The default value of the '{@link #getPattern() <em>Pattern</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPattern() |
| * @generated |
| * @ordered |
| */ |
| protected static final String PATTERN_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getPattern() <em>Pattern</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPattern() |
| * @generated |
| * @ordered |
| */ |
| protected String pattern = PATTERN_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getFrom() <em>From</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFrom() |
| * @generated |
| * @ordered |
| */ |
| protected Element from; |
| |
| /** |
| * The cached value of the '{@link #getTo() <em>To</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTo() |
| * @generated |
| * @ordered |
| */ |
| protected Element to; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected CreateConnectionImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return DiagramPackage.Literals.CREATE_CONNECTION; |
| } |
| |
| /** |
| * <!-- 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, DiagramPackage.CREATE_CONNECTION__ID, oldId, id)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Element getElement() { |
| return element; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetElement(Element newElement, NotificationChain msgs) { |
| Element oldElement = element; |
| element = newElement; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DiagramPackage.CREATE_CONNECTION__ELEMENT, oldElement, newElement); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setElement(Element newElement) { |
| if (newElement != element) { |
| NotificationChain msgs = null; |
| if (element != null) |
| msgs = ((InternalEObject)element).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DiagramPackage.CREATE_CONNECTION__ELEMENT, null, msgs); |
| if (newElement != null) |
| msgs = ((InternalEObject)newElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DiagramPackage.CREATE_CONNECTION__ELEMENT, null, msgs); |
| msgs = basicSetElement(newElement, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DiagramPackage.CREATE_CONNECTION__ELEMENT, newElement, newElement)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getPattern() { |
| return pattern; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPattern(String newPattern) { |
| String oldPattern = pattern; |
| pattern = newPattern; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DiagramPackage.CREATE_CONNECTION__PATTERN, oldPattern, pattern)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Element getFrom() { |
| if (from != null && from.eIsProxy()) { |
| InternalEObject oldFrom = (InternalEObject)from; |
| from = (Element)eResolveProxy(oldFrom); |
| if (from != oldFrom) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiagramPackage.CREATE_CONNECTION__FROM, oldFrom, from)); |
| } |
| } |
| return from; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Element basicGetFrom() { |
| return from; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setFrom(Element newFrom) { |
| Element oldFrom = from; |
| from = newFrom; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DiagramPackage.CREATE_CONNECTION__FROM, oldFrom, from)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Element getTo() { |
| if (to != null && to.eIsProxy()) { |
| InternalEObject oldTo = (InternalEObject)to; |
| to = (Element)eResolveProxy(oldTo); |
| if (to != oldTo) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, DiagramPackage.CREATE_CONNECTION__TO, oldTo, to)); |
| } |
| } |
| return to; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Element basicGetTo() { |
| return to; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setTo(Element newTo) { |
| Element oldTo = to; |
| to = newTo; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, DiagramPackage.CREATE_CONNECTION__TO, oldTo, to)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case DiagramPackage.CREATE_CONNECTION__ELEMENT: |
| return basicSetElement(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 DiagramPackage.CREATE_CONNECTION__ID: |
| return getId(); |
| case DiagramPackage.CREATE_CONNECTION__ELEMENT: |
| return getElement(); |
| case DiagramPackage.CREATE_CONNECTION__PATTERN: |
| return getPattern(); |
| case DiagramPackage.CREATE_CONNECTION__FROM: |
| if (resolve) return getFrom(); |
| return basicGetFrom(); |
| case DiagramPackage.CREATE_CONNECTION__TO: |
| if (resolve) return getTo(); |
| return basicGetTo(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case DiagramPackage.CREATE_CONNECTION__ID: |
| setId((Integer)newValue); |
| return; |
| case DiagramPackage.CREATE_CONNECTION__ELEMENT: |
| setElement((Element)newValue); |
| return; |
| case DiagramPackage.CREATE_CONNECTION__PATTERN: |
| setPattern((String)newValue); |
| return; |
| case DiagramPackage.CREATE_CONNECTION__FROM: |
| setFrom((Element)newValue); |
| return; |
| case DiagramPackage.CREATE_CONNECTION__TO: |
| setTo((Element)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case DiagramPackage.CREATE_CONNECTION__ID: |
| setId(ID_EDEFAULT); |
| return; |
| case DiagramPackage.CREATE_CONNECTION__ELEMENT: |
| setElement((Element)null); |
| return; |
| case DiagramPackage.CREATE_CONNECTION__PATTERN: |
| setPattern(PATTERN_EDEFAULT); |
| return; |
| case DiagramPackage.CREATE_CONNECTION__FROM: |
| setFrom((Element)null); |
| return; |
| case DiagramPackage.CREATE_CONNECTION__TO: |
| setTo((Element)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case DiagramPackage.CREATE_CONNECTION__ID: |
| return id != ID_EDEFAULT; |
| case DiagramPackage.CREATE_CONNECTION__ELEMENT: |
| return element != null; |
| case DiagramPackage.CREATE_CONNECTION__PATTERN: |
| return PATTERN_EDEFAULT == null ? pattern != null : !PATTERN_EDEFAULT.equals(pattern); |
| case DiagramPackage.CREATE_CONNECTION__FROM: |
| return from != null; |
| case DiagramPackage.CREATE_CONNECTION__TO: |
| return to != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (id: "); |
| result.append(id); |
| result.append(", pattern: "); |
| result.append(pattern); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //CreateConnectionImpl |