| /******************************************************************************* |
| * Copyright (c) 2009, 2019 Xored Software Inc and others. |
| * 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 |
| * https://www.eclipse.org/legal/epl-v20.html |
| * |
| * Contributors: |
| * Xored Software Inc - initial API and implementation and/or initial documentation |
| *******************************************************************************/ |
| package org.eclipse.rcptt.tesla.core.protocol.impl; |
| |
| import org.eclipse.rcptt.tesla.core.protocol.ProtocolPackage; |
| import org.eclipse.rcptt.tesla.core.protocol.SelectCommand; |
| import org.eclipse.rcptt.tesla.core.protocol.SelectData; |
| |
| import java.util.Collection; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| import org.eclipse.emf.common.util.EList; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.InternalEObject; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.ecore.impl.EObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Select Command</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * </p> |
| * <ul> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.SelectCommandImpl#getId <em>Id</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.SelectCommandImpl#getData <em>Data</em>}</li> |
| * <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.SelectCommandImpl#getContainChildren <em>Contain Children</em>}</li> |
| * </ul> |
| * |
| * @generated |
| */ |
| public class SelectCommandImpl extends EObjectImpl implements SelectCommand { |
| /** |
| * The default value of the '{@link #getId() <em>Id</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected static final int ID_EDEFAULT = 0; |
| |
| /** |
| * The cached value of the '{@link #getId() <em>Id</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected int id = ID_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getData() <em>Data</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getData() |
| * @generated |
| * @ordered |
| */ |
| protected SelectData data; |
| |
| /** |
| * The cached value of the '{@link #getContainChildren() <em>Contain Children</em>}' containment reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getContainChildren() |
| * @generated |
| * @ordered |
| */ |
| protected EList<SelectData> containChildren; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected SelectCommandImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ProtocolPackage.Literals.SELECT_COMMAND; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public int getId() { |
| return id; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setId(int newId) { |
| int oldId = id; |
| id = newId; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.SELECT_COMMAND__ID, oldId, id)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public SelectData getData() { |
| return data; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetData(SelectData newData, NotificationChain msgs) { |
| SelectData oldData = data; |
| data = newData; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ProtocolPackage.SELECT_COMMAND__DATA, oldData, newData); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setData(SelectData newData) { |
| if (newData != data) { |
| NotificationChain msgs = null; |
| if (data != null) |
| msgs = ((InternalEObject)data).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.SELECT_COMMAND__DATA, null, msgs); |
| if (newData != null) |
| msgs = ((InternalEObject)newData).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.SELECT_COMMAND__DATA, null, msgs); |
| msgs = basicSetData(newData, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.SELECT_COMMAND__DATA, newData, newData)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<SelectData> getContainChildren() { |
| if (containChildren == null) { |
| containChildren = new EObjectContainmentEList<SelectData>(SelectData.class, this, ProtocolPackage.SELECT_COMMAND__CONTAIN_CHILDREN); |
| } |
| return containChildren; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ProtocolPackage.SELECT_COMMAND__DATA: |
| return basicSetData(null, msgs); |
| case ProtocolPackage.SELECT_COMMAND__CONTAIN_CHILDREN: |
| return ((InternalEList<?>)getContainChildren()).basicRemove(otherEnd, 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 ProtocolPackage.SELECT_COMMAND__ID: |
| return getId(); |
| case ProtocolPackage.SELECT_COMMAND__DATA: |
| return getData(); |
| case ProtocolPackage.SELECT_COMMAND__CONTAIN_CHILDREN: |
| return getContainChildren(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @SuppressWarnings("unchecked") |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case ProtocolPackage.SELECT_COMMAND__ID: |
| setId((Integer)newValue); |
| return; |
| case ProtocolPackage.SELECT_COMMAND__DATA: |
| setData((SelectData)newValue); |
| return; |
| case ProtocolPackage.SELECT_COMMAND__CONTAIN_CHILDREN: |
| getContainChildren().clear(); |
| getContainChildren().addAll((Collection<? extends SelectData>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ProtocolPackage.SELECT_COMMAND__ID: |
| setId(ID_EDEFAULT); |
| return; |
| case ProtocolPackage.SELECT_COMMAND__DATA: |
| setData((SelectData)null); |
| return; |
| case ProtocolPackage.SELECT_COMMAND__CONTAIN_CHILDREN: |
| getContainChildren().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ProtocolPackage.SELECT_COMMAND__ID: |
| return id != ID_EDEFAULT; |
| case ProtocolPackage.SELECT_COMMAND__DATA: |
| return data != null; |
| case ProtocolPackage.SELECT_COMMAND__CONTAIN_CHILDREN: |
| return containChildren != null && !containChildren.isEmpty(); |
| } |
| 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(" (id: "); |
| result.append(id); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //SelectCommandImpl |