| /** |
| * Copyright (c) 2011, 2018 - Loetz GmbH&Co.KG (69115 Heidelberg, Germany) |
| * 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: |
| * Christophe Loetz (Loetz GmbH&Co.KG) - initial implementation |
| * |
| * generated from SignalDSL.xcore |
| * |
| * |
| */ |
| package org.eclipse.osbp.xtext.signal.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.osbp.xtext.signal.SignalDSLPackage; |
| import org.eclipse.osbp.xtext.signal.SignalHandler; |
| import org.eclipse.osbp.xtext.signal.SignalHandling; |
| import org.eclipse.osbp.xtext.signal.SignalNotification; |
| import org.eclipse.osbp.xtext.signal.SignalWatcher; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Signal Handler</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.signal.impl.SignalHandlerImpl#getWatcher <em>Watcher</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.signal.impl.SignalHandlerImpl#getHandler <em>Handler</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.signal.impl.SignalHandlerImpl#getNotification <em>Notification</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class SignalHandlerImpl extends SignalLazyResolverImpl implements SignalHandler { |
| /** |
| * The cached value of the '{@link #getWatcher() <em>Watcher</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getWatcher() |
| * @generated |
| * @ordered |
| */ |
| protected SignalWatcher watcher; |
| |
| /** |
| * The cached value of the '{@link #getHandler() <em>Handler</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getHandler() |
| * @generated |
| * @ordered |
| */ |
| protected SignalHandling handler; |
| |
| /** |
| * The cached value of the '{@link #getNotification() <em>Notification</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getNotification() |
| * @generated |
| * @ordered |
| */ |
| protected SignalNotification notification; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SignalHandlerImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return SignalDSLPackage.Literals.SIGNAL_HANDLER; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SignalWatcher getWatcher() { |
| if (watcher != null && watcher.eIsProxy()) { |
| InternalEObject oldWatcher = (InternalEObject)watcher; |
| watcher = (SignalWatcher)eResolveProxy(oldWatcher); |
| if (watcher != oldWatcher) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, SignalDSLPackage.SIGNAL_HANDLER__WATCHER, oldWatcher, watcher)); |
| } |
| } |
| return watcher; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SignalWatcher basicGetWatcher() { |
| return watcher; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setWatcher(SignalWatcher newWatcher) { |
| SignalWatcher oldWatcher = watcher; |
| watcher = newWatcher; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SignalDSLPackage.SIGNAL_HANDLER__WATCHER, oldWatcher, watcher)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SignalHandling getHandler() { |
| return handler; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetHandler(SignalHandling newHandler, NotificationChain msgs) { |
| SignalHandling oldHandler = handler; |
| handler = newHandler; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SignalDSLPackage.SIGNAL_HANDLER__HANDLER, oldHandler, newHandler); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setHandler(SignalHandling newHandler) { |
| if (newHandler != handler) { |
| NotificationChain msgs = null; |
| if (handler != null) |
| msgs = ((InternalEObject)handler).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SignalDSLPackage.SIGNAL_HANDLER__HANDLER, null, msgs); |
| if (newHandler != null) |
| msgs = ((InternalEObject)newHandler).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SignalDSLPackage.SIGNAL_HANDLER__HANDLER, null, msgs); |
| msgs = basicSetHandler(newHandler, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SignalDSLPackage.SIGNAL_HANDLER__HANDLER, newHandler, newHandler)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SignalNotification getNotification() { |
| return notification; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetNotification(SignalNotification newNotification, NotificationChain msgs) { |
| SignalNotification oldNotification = notification; |
| notification = newNotification; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, SignalDSLPackage.SIGNAL_HANDLER__NOTIFICATION, oldNotification, newNotification); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setNotification(SignalNotification newNotification) { |
| if (newNotification != notification) { |
| NotificationChain msgs = null; |
| if (notification != null) |
| msgs = ((InternalEObject)notification).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - SignalDSLPackage.SIGNAL_HANDLER__NOTIFICATION, null, msgs); |
| if (newNotification != null) |
| msgs = ((InternalEObject)newNotification).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - SignalDSLPackage.SIGNAL_HANDLER__NOTIFICATION, null, msgs); |
| msgs = basicSetNotification(newNotification, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, SignalDSLPackage.SIGNAL_HANDLER__NOTIFICATION, newNotification, newNotification)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case SignalDSLPackage.SIGNAL_HANDLER__HANDLER: |
| return basicSetHandler(null, msgs); |
| case SignalDSLPackage.SIGNAL_HANDLER__NOTIFICATION: |
| return basicSetNotification(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 SignalDSLPackage.SIGNAL_HANDLER__WATCHER: |
| if (resolve) return getWatcher(); |
| return basicGetWatcher(); |
| case SignalDSLPackage.SIGNAL_HANDLER__HANDLER: |
| return getHandler(); |
| case SignalDSLPackage.SIGNAL_HANDLER__NOTIFICATION: |
| return getNotification(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case SignalDSLPackage.SIGNAL_HANDLER__WATCHER: |
| setWatcher((SignalWatcher)newValue); |
| return; |
| case SignalDSLPackage.SIGNAL_HANDLER__HANDLER: |
| setHandler((SignalHandling)newValue); |
| return; |
| case SignalDSLPackage.SIGNAL_HANDLER__NOTIFICATION: |
| setNotification((SignalNotification)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case SignalDSLPackage.SIGNAL_HANDLER__WATCHER: |
| setWatcher((SignalWatcher)null); |
| return; |
| case SignalDSLPackage.SIGNAL_HANDLER__HANDLER: |
| setHandler((SignalHandling)null); |
| return; |
| case SignalDSLPackage.SIGNAL_HANDLER__NOTIFICATION: |
| setNotification((SignalNotification)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case SignalDSLPackage.SIGNAL_HANDLER__WATCHER: |
| return watcher != null; |
| case SignalDSLPackage.SIGNAL_HANDLER__HANDLER: |
| return handler != null; |
| case SignalDSLPackage.SIGNAL_HANDLER__NOTIFICATION: |
| return notification != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| } //SignalHandlerImpl |