blob: e55c679c9f92758cc4755c638abd6ad7c85cb1f2 [file] [log] [blame]
/**
* 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.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.statemachine.FSMActionFieldConcatenation;
import org.eclipse.osbp.xtext.statemachine.FSMActionPeripheralPrintNormal;
import org.eclipse.osbp.xtext.statemachine.FSMPOSPrinterBarcodeType;
import org.eclipse.osbp.xtext.statemachine.FSMPeripheralDevicePOSPrinter;
import org.eclipse.osbp.xtext.statemachine.StatemachineDSLPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>FSM Action Peripheral Print Normal</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.osbp.xtext.statemachine.impl.FSMActionPeripheralPrintNormalImpl#getDevice <em>Device</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.statemachine.impl.FSMActionPeripheralPrintNormalImpl#getText <em>Text</em>}</li>
* <li>{@link org.eclipse.osbp.xtext.statemachine.impl.FSMActionPeripheralPrintNormalImpl#getBarcodeType <em>Barcode Type</em>}</li>
* </ul>
*
* @generated
*/
public class FSMActionPeripheralPrintNormalImpl extends FSMLazyResolverImpl implements FSMActionPeripheralPrintNormal {
/**
* The cached value of the '{@link #getDevice() <em>Device</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDevice()
* @generated
* @ordered
*/
protected FSMPeripheralDevicePOSPrinter device;
/**
* The cached value of the '{@link #getText() <em>Text</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getText()
* @generated
* @ordered
*/
protected FSMActionFieldConcatenation text;
/**
* The default value of the '{@link #getBarcodeType() <em>Barcode Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBarcodeType()
* @generated
* @ordered
*/
protected static final FSMPOSPrinterBarcodeType BARCODE_TYPE_EDEFAULT = FSMPOSPrinterBarcodeType.PTR_BCS_UPCA;
/**
* The cached value of the '{@link #getBarcodeType() <em>Barcode Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBarcodeType()
* @generated
* @ordered
*/
protected FSMPOSPrinterBarcodeType barcodeType = BARCODE_TYPE_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected FSMActionPeripheralPrintNormalImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return StatemachineDSLPackage.Literals.FSM_ACTION_PERIPHERAL_PRINT_NORMAL;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FSMPeripheralDevicePOSPrinter getDevice() {
if (device != null && device.eIsProxy()) {
InternalEObject oldDevice = (InternalEObject)device;
device = (FSMPeripheralDevicePOSPrinter)eResolveProxy(oldDevice);
if (device != oldDevice) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__DEVICE, oldDevice, device));
}
}
return device;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FSMPeripheralDevicePOSPrinter basicGetDevice() {
return device;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDevice(FSMPeripheralDevicePOSPrinter newDevice) {
FSMPeripheralDevicePOSPrinter oldDevice = device;
device = newDevice;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__DEVICE, oldDevice, device));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FSMActionFieldConcatenation getText() {
return text;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetText(FSMActionFieldConcatenation newText, NotificationChain msgs) {
FSMActionFieldConcatenation oldText = text;
text = newText;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__TEXT, oldText, newText);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setText(FSMActionFieldConcatenation newText) {
if (newText != text) {
NotificationChain msgs = null;
if (text != null)
msgs = ((InternalEObject)text).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__TEXT, null, msgs);
if (newText != null)
msgs = ((InternalEObject)newText).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__TEXT, null, msgs);
msgs = basicSetText(newText, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__TEXT, newText, newText));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FSMPOSPrinterBarcodeType getBarcodeType() {
return barcodeType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBarcodeType(FSMPOSPrinterBarcodeType newBarcodeType) {
FSMPOSPrinterBarcodeType oldBarcodeType = barcodeType;
barcodeType = newBarcodeType == null ? BARCODE_TYPE_EDEFAULT : newBarcodeType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__BARCODE_TYPE, oldBarcodeType, barcodeType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__TEXT:
return basicSetText(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 StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__DEVICE:
if (resolve) return getDevice();
return basicGetDevice();
case StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__TEXT:
return getText();
case StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__BARCODE_TYPE:
return getBarcodeType();
}
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_ACTION_PERIPHERAL_PRINT_NORMAL__DEVICE:
setDevice((FSMPeripheralDevicePOSPrinter)newValue);
return;
case StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__TEXT:
setText((FSMActionFieldConcatenation)newValue);
return;
case StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__BARCODE_TYPE:
setBarcodeType((FSMPOSPrinterBarcodeType)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__DEVICE:
setDevice((FSMPeripheralDevicePOSPrinter)null);
return;
case StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__TEXT:
setText((FSMActionFieldConcatenation)null);
return;
case StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__BARCODE_TYPE:
setBarcodeType(BARCODE_TYPE_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__DEVICE:
return device != null;
case StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__TEXT:
return text != null;
case StatemachineDSLPackage.FSM_ACTION_PERIPHERAL_PRINT_NORMAL__BARCODE_TYPE:
return barcodeType != BARCODE_TYPE_EDEFAULT;
}
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(" (barcodeType: ");
result.append(barcodeType);
result.append(')');
return result.toString();
}
} //FSMActionPeripheralPrintNormalImpl