| /** |
| * Copyright (c) 2011, 2017 - 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 2.0 |
| * which accompanies this distribution, and is available at |
| * https://www.eclipse.org/legal/epl-2.0/ |
| * |
| * SPDX-License-Identifier: EPL-2.0 |
| * |
| * Based on ideas from Xtext, Xtend, Xcore |
| * |
| * Contributors: |
| * Joerg Riegel - Initial implementation |
| * |
| */ |
| package org.eclipse.osbp.xtext.statemachine.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| |
| import org.eclipse.osbp.xtext.statemachine.FSMControlSchedulerAttribute; |
| import org.eclipse.osbp.xtext.statemachine.FSMEvent; |
| import org.eclipse.osbp.xtext.statemachine.StatemachineDSLPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>FSM Control Scheduler Attribute</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.osbp.xtext.statemachine.impl.FSMControlSchedulerAttributeImpl#getDelay <em>Delay</em>}</li> |
| * <li>{@link org.eclipse.osbp.xtext.statemachine.impl.FSMControlSchedulerAttributeImpl#getEvent <em>Event</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class FSMControlSchedulerAttributeImpl extends FSMBaseImpl implements FSMControlSchedulerAttribute { |
| /** |
| * The default value of the '{@link #getDelay() <em>Delay</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDelay() |
| * @generated |
| * @ordered |
| */ |
| protected static final int DELAY_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getDelay() <em>Delay</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDelay() |
| * @generated |
| * @ordered |
| */ |
| protected int delay = DELAY_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getEvent() <em>Event</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEvent() |
| * @generated |
| * @ordered |
| */ |
| protected FSMEvent event; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected FSMControlSchedulerAttributeImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return StatemachineDSLPackage.Literals.FSM_CONTROL_SCHEDULER_ATTRIBUTE; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getDelay() { |
| return delay; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setDelay(int newDelay) { |
| int oldDelay = delay; |
| delay = newDelay; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, StatemachineDSLPackage.FSM_CONTROL_SCHEDULER_ATTRIBUTE__DELAY, oldDelay, delay)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FSMEvent getEvent() { |
| if (event != null && event.eIsProxy()) { |
| InternalEObject oldEvent = (InternalEObject)event; |
| event = (FSMEvent)eResolveProxy(oldEvent); |
| if (event != oldEvent) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, StatemachineDSLPackage.FSM_CONTROL_SCHEDULER_ATTRIBUTE__EVENT, oldEvent, event)); |
| } |
| } |
| return event; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public FSMEvent basicGetEvent() { |
| return event; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setEvent(FSMEvent newEvent) { |
| FSMEvent oldEvent = event; |
| event = newEvent; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, StatemachineDSLPackage.FSM_CONTROL_SCHEDULER_ATTRIBUTE__EVENT, oldEvent, event)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case StatemachineDSLPackage.FSM_CONTROL_SCHEDULER_ATTRIBUTE__DELAY: |
| return getDelay(); |
| case StatemachineDSLPackage.FSM_CONTROL_SCHEDULER_ATTRIBUTE__EVENT: |
| if (resolve) return getEvent(); |
| return basicGetEvent(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case StatemachineDSLPackage.FSM_CONTROL_SCHEDULER_ATTRIBUTE__DELAY: |
| setDelay((Integer)newValue); |
| return; |
| case StatemachineDSLPackage.FSM_CONTROL_SCHEDULER_ATTRIBUTE__EVENT: |
| setEvent((FSMEvent)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case StatemachineDSLPackage.FSM_CONTROL_SCHEDULER_ATTRIBUTE__DELAY: |
| setDelay(DELAY_EDEFAULT); |
| return; |
| case StatemachineDSLPackage.FSM_CONTROL_SCHEDULER_ATTRIBUTE__EVENT: |
| setEvent((FSMEvent)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case StatemachineDSLPackage.FSM_CONTROL_SCHEDULER_ATTRIBUTE__DELAY: |
| return delay != DELAY_EDEFAULT; |
| case StatemachineDSLPackage.FSM_CONTROL_SCHEDULER_ATTRIBUTE__EVENT: |
| return event != 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(" (delay: "); |
| result.append(delay); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //FSMControlSchedulerAttributeImpl |