| /******************************************************************************* |
| * <copyright> |
| * |
| * Copyright (c) 2013, 2013 SAP AG. |
| * 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: |
| * SAP AG - initial API, implementation and documentation |
| * |
| * </copyright> |
| * |
| *******************************************************************************/ |
| package org.eclipse.fmc.mm.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.fmc.mm.Agent; |
| import org.eclipse.fmc.mm.Channel; |
| import org.eclipse.fmc.mm.DataflowDirection; |
| import org.eclipse.fmc.mm.FmcPackage; |
| import org.eclipse.fmc.mm.IFMCElementVisitor; |
| import org.eclipse.fmc.mm.RequestDirection; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Channel</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.fmc.mm.impl.ChannelImpl#getChannelType <em>Channel Type</em>}</li> |
| * <li>{@link org.eclipse.fmc.mm.impl.ChannelImpl#getSource <em>Source</em>}</li> |
| * <li>{@link org.eclipse.fmc.mm.impl.ChannelImpl#getTarget <em>Target</em>}</li> |
| * <li>{@link org.eclipse.fmc.mm.impl.ChannelImpl#getDataflowDirection <em>Dataflow Direction</em>}</li> |
| * <li>{@link org.eclipse.fmc.mm.impl.ChannelImpl#getName <em>Name</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ChannelImpl extends FMCConnectionImpl implements Channel { |
| /** |
| * The default value of the '{@link #getChannelType() <em>Channel Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getChannelType() |
| * @generated |
| * @ordered |
| */ |
| protected static final RequestDirection CHANNEL_TYPE_EDEFAULT = RequestDirection.UNSPECIFIED; |
| |
| /** |
| * The cached value of the '{@link #getChannelType() <em>Channel Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getChannelType() |
| * @generated |
| * @ordered |
| */ |
| protected RequestDirection channelType = CHANNEL_TYPE_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getSource() <em>Source</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSource() |
| * @generated |
| * @ordered |
| */ |
| protected Agent source; |
| |
| /** |
| * The cached value of the '{@link #getTarget() <em>Target</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTarget() |
| * @generated |
| * @ordered |
| */ |
| protected Agent target; |
| |
| /** |
| * The default value of the '{@link #getDataflowDirection() <em>Dataflow Direction</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDataflowDirection() |
| * @generated |
| * @ordered |
| */ |
| protected static final DataflowDirection DATAFLOW_DIRECTION_EDEFAULT = DataflowDirection.UNSPECIFIED; |
| |
| /** |
| * The cached value of the '{@link #getDataflowDirection() <em>Dataflow Direction</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDataflowDirection() |
| * @generated |
| * @ordered |
| */ |
| protected DataflowDirection dataflowDirection = DATAFLOW_DIRECTION_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected static final String NAME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getName() <em>Name</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getName() |
| * @generated |
| * @ordered |
| */ |
| protected String name = NAME_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected ChannelImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FmcPackage.Literals.CHANNEL; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public RequestDirection getChannelType() { |
| return channelType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setChannelType(RequestDirection newChannelType) { |
| RequestDirection oldChannelType = channelType; |
| channelType = newChannelType == null ? CHANNEL_TYPE_EDEFAULT : newChannelType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__CHANNEL_TYPE, oldChannelType, channelType)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Agent getSource() { |
| if (source != null && source.eIsProxy()) { |
| InternalEObject oldSource = (InternalEObject)source; |
| source = (Agent)eResolveProxy(oldSource); |
| if (source != oldSource) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FmcPackage.CHANNEL__SOURCE, oldSource, source)); |
| } |
| } |
| return source; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Agent basicGetSource() { |
| return source; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetSource(Agent newSource, NotificationChain msgs) { |
| Agent oldSource = source; |
| source = newSource; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__SOURCE, oldSource, newSource); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSource(Agent newSource) { |
| if (newSource != source) { |
| NotificationChain msgs = null; |
| if (source != null) |
| msgs = ((InternalEObject)source).eInverseRemove(this, FmcPackage.AGENT__SOURCE_CHANNELS, Agent.class, msgs); |
| if (newSource != null) |
| msgs = ((InternalEObject)newSource).eInverseAdd(this, FmcPackage.AGENT__SOURCE_CHANNELS, Agent.class, msgs); |
| msgs = basicSetSource(newSource, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__SOURCE, newSource, newSource)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Agent getTarget() { |
| if (target != null && target.eIsProxy()) { |
| InternalEObject oldTarget = (InternalEObject)target; |
| target = (Agent)eResolveProxy(oldTarget); |
| if (target != oldTarget) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FmcPackage.CHANNEL__TARGET, oldTarget, target)); |
| } |
| } |
| return target; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Agent basicGetTarget() { |
| return target; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetTarget(Agent newTarget, NotificationChain msgs) { |
| Agent oldTarget = target; |
| target = newTarget; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__TARGET, oldTarget, newTarget); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setTarget(Agent newTarget) { |
| if (newTarget != target) { |
| NotificationChain msgs = null; |
| if (target != null) |
| msgs = ((InternalEObject)target).eInverseRemove(this, FmcPackage.AGENT__TARGET_CHANNELS, Agent.class, msgs); |
| if (newTarget != null) |
| msgs = ((InternalEObject)newTarget).eInverseAdd(this, FmcPackage.AGENT__TARGET_CHANNELS, Agent.class, msgs); |
| msgs = basicSetTarget(newTarget, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__TARGET, newTarget, newTarget)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public DataflowDirection getDataflowDirection() { |
| return dataflowDirection; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setDataflowDirection(DataflowDirection newDataflowDirection) { |
| DataflowDirection oldDataflowDirection = dataflowDirection; |
| dataflowDirection = newDataflowDirection == null ? DATAFLOW_DIRECTION_EDEFAULT : newDataflowDirection; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__DATAFLOW_DIRECTION, oldDataflowDirection, dataflowDirection)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getName() { |
| return name; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setName(String newName) { |
| String oldName = name; |
| name = newName; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FmcPackage.CHANNEL__NAME, oldName, name)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FmcPackage.CHANNEL__SOURCE: |
| if (source != null) |
| msgs = ((InternalEObject)source).eInverseRemove(this, FmcPackage.AGENT__SOURCE_CHANNELS, Agent.class, msgs); |
| return basicSetSource((Agent)otherEnd, msgs); |
| case FmcPackage.CHANNEL__TARGET: |
| if (target != null) |
| msgs = ((InternalEObject)target).eInverseRemove(this, FmcPackage.AGENT__TARGET_CHANNELS, Agent.class, msgs); |
| return basicSetTarget((Agent)otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FmcPackage.CHANNEL__SOURCE: |
| return basicSetSource(null, msgs); |
| case FmcPackage.CHANNEL__TARGET: |
| return basicSetTarget(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 FmcPackage.CHANNEL__CHANNEL_TYPE: |
| return getChannelType(); |
| case FmcPackage.CHANNEL__SOURCE: |
| if (resolve) return getSource(); |
| return basicGetSource(); |
| case FmcPackage.CHANNEL__TARGET: |
| if (resolve) return getTarget(); |
| return basicGetTarget(); |
| case FmcPackage.CHANNEL__DATAFLOW_DIRECTION: |
| return getDataflowDirection(); |
| case FmcPackage.CHANNEL__NAME: |
| return getName(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case FmcPackage.CHANNEL__CHANNEL_TYPE: |
| setChannelType((RequestDirection)newValue); |
| return; |
| case FmcPackage.CHANNEL__SOURCE: |
| setSource((Agent)newValue); |
| return; |
| case FmcPackage.CHANNEL__TARGET: |
| setTarget((Agent)newValue); |
| return; |
| case FmcPackage.CHANNEL__DATAFLOW_DIRECTION: |
| setDataflowDirection((DataflowDirection)newValue); |
| return; |
| case FmcPackage.CHANNEL__NAME: |
| setName((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FmcPackage.CHANNEL__CHANNEL_TYPE: |
| setChannelType(CHANNEL_TYPE_EDEFAULT); |
| return; |
| case FmcPackage.CHANNEL__SOURCE: |
| setSource((Agent)null); |
| return; |
| case FmcPackage.CHANNEL__TARGET: |
| setTarget((Agent)null); |
| return; |
| case FmcPackage.CHANNEL__DATAFLOW_DIRECTION: |
| setDataflowDirection(DATAFLOW_DIRECTION_EDEFAULT); |
| return; |
| case FmcPackage.CHANNEL__NAME: |
| setName(NAME_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FmcPackage.CHANNEL__CHANNEL_TYPE: |
| return channelType != CHANNEL_TYPE_EDEFAULT; |
| case FmcPackage.CHANNEL__SOURCE: |
| return source != null; |
| case FmcPackage.CHANNEL__TARGET: |
| return target != null; |
| case FmcPackage.CHANNEL__DATAFLOW_DIRECTION: |
| return dataflowDirection != DATAFLOW_DIRECTION_EDEFAULT; |
| case FmcPackage.CHANNEL__NAME: |
| return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); |
| } |
| 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(" (channelType: "); |
| result.append(channelType); |
| result.append(", dataflowDirection: "); |
| result.append(dataflowDirection); |
| result.append(", name: "); |
| result.append(name); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> <!-- end-user-doc --> |
| * |
| * @generated NOT |
| */ |
| @Override |
| public Object accept(IFMCElementVisitor visitor, Object object) { |
| return visitor.visitChannel(this, object); |
| } |
| |
| } //ChannelImpl |