| /** |
| * **************************************************************************** |
| * Copyright (c) 2020 CEA LIST. |
| * |
| * |
| * 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 |
| * |
| * Contributors: |
| * Asma Smaoui (CEA LIST) asma.smaoui@cea.fr - Initial API and implementation |
| * |
| * **************************************************************************** |
| */ |
| package io.shell.admin.aas._1._0.impl; |
| |
| import io.shell.admin.aas._1._0.PropertyT; |
| import io.shell.admin.aas._1._0.PropertyValueTypeT; |
| import io.shell.admin.aas._1._0.ReferenceT; |
| import io.shell.admin.aas._1._0._0Package; |
| |
| 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; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Property T</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link io.shell.admin.aas._1._0.impl.PropertyTImpl#getValueType <em>Value Type</em>}</li> |
| * <li>{@link io.shell.admin.aas._1._0.impl.PropertyTImpl#getValue <em>Value</em>}</li> |
| * <li>{@link io.shell.admin.aas._1._0.impl.PropertyTImpl#getValueId <em>Value Id</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class PropertyTImpl extends SubmodelElementAbstractTImpl implements PropertyT { |
| /** |
| * The default value of the '{@link #getValueType() <em>Value Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValueType() |
| * @generated |
| * @ordered |
| */ |
| protected static final String VALUE_TYPE_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getValueType() <em>Value Type</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValueType() |
| * @generated |
| * @ordered |
| */ |
| protected String valueType = VALUE_TYPE_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getValue() <em>Value</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValue() |
| * @generated |
| * @ordered |
| */ |
| protected PropertyValueTypeT value; |
| |
| /** |
| * The cached value of the '{@link #getValueId() <em>Value Id</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getValueId() |
| * @generated |
| * @ordered |
| */ |
| protected ReferenceT valueId; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PropertyTImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return _0Package.Literals.PROPERTY_T; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getValueType() { |
| return valueType; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setValueType(String newValueType) { |
| String oldValueType = valueType; |
| valueType = newValueType; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, _0Package.PROPERTY_T__VALUE_TYPE, oldValueType, valueType)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public PropertyValueTypeT getValue() { |
| return value; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetValue(PropertyValueTypeT newValue, NotificationChain msgs) { |
| PropertyValueTypeT oldValue = value; |
| value = newValue; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, _0Package.PROPERTY_T__VALUE, oldValue, newValue); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setValue(PropertyValueTypeT newValue) { |
| if (newValue != value) { |
| NotificationChain msgs = null; |
| if (value != null) |
| msgs = ((InternalEObject)value).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - _0Package.PROPERTY_T__VALUE, null, msgs); |
| if (newValue != null) |
| msgs = ((InternalEObject)newValue).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - _0Package.PROPERTY_T__VALUE, null, msgs); |
| msgs = basicSetValue(newValue, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, _0Package.PROPERTY_T__VALUE, newValue, newValue)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ReferenceT getValueId() { |
| return valueId; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetValueId(ReferenceT newValueId, NotificationChain msgs) { |
| ReferenceT oldValueId = valueId; |
| valueId = newValueId; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, _0Package.PROPERTY_T__VALUE_ID, oldValueId, newValueId); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setValueId(ReferenceT newValueId) { |
| if (newValueId != valueId) { |
| NotificationChain msgs = null; |
| if (valueId != null) |
| msgs = ((InternalEObject)valueId).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - _0Package.PROPERTY_T__VALUE_ID, null, msgs); |
| if (newValueId != null) |
| msgs = ((InternalEObject)newValueId).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - _0Package.PROPERTY_T__VALUE_ID, null, msgs); |
| msgs = basicSetValueId(newValueId, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, _0Package.PROPERTY_T__VALUE_ID, newValueId, newValueId)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case _0Package.PROPERTY_T__VALUE: |
| return basicSetValue(null, msgs); |
| case _0Package.PROPERTY_T__VALUE_ID: |
| return basicSetValueId(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 _0Package.PROPERTY_T__VALUE_TYPE: |
| return getValueType(); |
| case _0Package.PROPERTY_T__VALUE: |
| return getValue(); |
| case _0Package.PROPERTY_T__VALUE_ID: |
| return getValueId(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case _0Package.PROPERTY_T__VALUE_TYPE: |
| setValueType((String)newValue); |
| return; |
| case _0Package.PROPERTY_T__VALUE: |
| setValue((PropertyValueTypeT)newValue); |
| return; |
| case _0Package.PROPERTY_T__VALUE_ID: |
| setValueId((ReferenceT)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case _0Package.PROPERTY_T__VALUE_TYPE: |
| setValueType(VALUE_TYPE_EDEFAULT); |
| return; |
| case _0Package.PROPERTY_T__VALUE: |
| setValue((PropertyValueTypeT)null); |
| return; |
| case _0Package.PROPERTY_T__VALUE_ID: |
| setValueId((ReferenceT)null); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case _0Package.PROPERTY_T__VALUE_TYPE: |
| return VALUE_TYPE_EDEFAULT == null ? valueType != null : !VALUE_TYPE_EDEFAULT.equals(valueType); |
| case _0Package.PROPERTY_T__VALUE: |
| return value != null; |
| case _0Package.PROPERTY_T__VALUE_ID: |
| return valueId != null; |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuilder result = new StringBuilder(super.toString()); |
| result.append(" (valueType: "); |
| result.append(valueType); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //PropertyTImpl |