blob: 0ba5b3b90bdb06991ada02a28d5d9374d6c6e1d5 [file] [log] [blame]
/*******************************************************************************
* 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 v2.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.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.emf.ecore.impl.EObjectImpl;
import org.eclipse.rcptt.tesla.core.protocol.ProtocolPackage;
import org.eclipse.rcptt.tesla.core.protocol.UpdateControlCommand;
import org.eclipse.rcptt.tesla.core.protocol.raw.Element;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Update Control Command</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.UpdateControlCommandImpl#getId <em>Id</em>}</li>
* <li>{@link org.eclipse.rcptt.tesla.core.protocol.impl.UpdateControlCommandImpl#getElements <em>Elements</em>}</li>
* </ul>
*
* @generated
*/
public class UpdateControlCommandImpl extends EObjectImpl implements UpdateControlCommand {
/**
* 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 #getElements() <em>Elements</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getElements()
* @generated
* @ordered
*/
protected Element elements;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected UpdateControlCommandImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ProtocolPackage.Literals.UPDATE_CONTROL_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.UPDATE_CONTROL_COMMAND__ID, oldId, id));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Element getElements() {
return elements;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetElements(Element newElements, NotificationChain msgs) {
Element oldElements = elements;
elements = newElements;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ProtocolPackage.UPDATE_CONTROL_COMMAND__ELEMENTS, oldElements, newElements);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setElements(Element newElements) {
if (newElements != elements) {
NotificationChain msgs = null;
if (elements != null)
msgs = ((InternalEObject)elements).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.UPDATE_CONTROL_COMMAND__ELEMENTS, null, msgs);
if (newElements != null)
msgs = ((InternalEObject)newElements).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - ProtocolPackage.UPDATE_CONTROL_COMMAND__ELEMENTS, null, msgs);
msgs = basicSetElements(newElements, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ProtocolPackage.UPDATE_CONTROL_COMMAND__ELEMENTS, newElements, newElements));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ProtocolPackage.UPDATE_CONTROL_COMMAND__ELEMENTS:
return basicSetElements(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 ProtocolPackage.UPDATE_CONTROL_COMMAND__ID:
return getId();
case ProtocolPackage.UPDATE_CONTROL_COMMAND__ELEMENTS:
return getElements();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ProtocolPackage.UPDATE_CONTROL_COMMAND__ID:
setId((Integer)newValue);
return;
case ProtocolPackage.UPDATE_CONTROL_COMMAND__ELEMENTS:
setElements((Element)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ProtocolPackage.UPDATE_CONTROL_COMMAND__ID:
setId(ID_EDEFAULT);
return;
case ProtocolPackage.UPDATE_CONTROL_COMMAND__ELEMENTS:
setElements((Element)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ProtocolPackage.UPDATE_CONTROL_COMMAND__ID:
return id != ID_EDEFAULT;
case ProtocolPackage.UPDATE_CONTROL_COMMAND__ELEMENTS:
return elements != 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(" (id: ");
result.append(id);
result.append(')');
return result.toString();
}
} //UpdateControlCommandImpl