blob: 6d430ef7f4d63da56f64814f38089d88f7669322 [file] [log] [blame]
/**
* *******************************************************************************
* Copyright (c) 2015-2021 Robert Bosch GmbH and others.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Generated using Eclipse EMF
*
* *******************************************************************************
*/
package org.eclipse.app4mc.amalthea.model.impl;
import org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
import org.eclipse.app4mc.amalthea.model.Component;
import org.eclipse.app4mc.amalthea.model.ComponentEvent;
import org.eclipse.app4mc.amalthea.model.ComponentEventType;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Component Event</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.ComponentEventImpl#getEventType <em>Event Type</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.ComponentEventImpl#getEntity <em>Entity</em>}</li>
* </ul>
*
* @generated
*/
public class ComponentEventImpl extends EntityEventImpl implements ComponentEvent {
/**
* The default value of the '{@link #getEventType() <em>Event Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEventType()
* @generated
* @ordered
*/
protected static final ComponentEventType EVENT_TYPE_EDEFAULT = ComponentEventType._ALL_;
/**
* The cached value of the '{@link #getEventType() <em>Event Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEventType()
* @generated
* @ordered
*/
protected ComponentEventType eventType = EVENT_TYPE_EDEFAULT;
/**
* The cached value of the '{@link #getEntity() <em>Entity</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEntity()
* @generated
* @ordered
*/
protected Component entity;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ComponentEventImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AmaltheaPackage.eINSTANCE.getComponentEvent();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public ComponentEventType getEventType() {
return eventType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setEventType(ComponentEventType newEventType) {
ComponentEventType oldEventType = eventType;
eventType = newEventType == null ? EVENT_TYPE_EDEFAULT : newEventType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.COMPONENT_EVENT__EVENT_TYPE, oldEventType, eventType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Component getEntity() {
if (entity != null && entity.eIsProxy()) {
InternalEObject oldEntity = (InternalEObject)entity;
entity = (Component)eResolveProxy(oldEntity);
if (entity != oldEntity) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, AmaltheaPackage.COMPONENT_EVENT__ENTITY, oldEntity, entity));
}
}
return entity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Component basicGetEntity() {
return entity;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setEntity(Component newEntity) {
Component oldEntity = entity;
entity = newEntity;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.COMPONENT_EVENT__ENTITY, oldEntity, entity));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AmaltheaPackage.COMPONENT_EVENT__EVENT_TYPE:
return getEventType();
case AmaltheaPackage.COMPONENT_EVENT__ENTITY:
if (resolve) return getEntity();
return basicGetEntity();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case AmaltheaPackage.COMPONENT_EVENT__EVENT_TYPE:
setEventType((ComponentEventType)newValue);
return;
case AmaltheaPackage.COMPONENT_EVENT__ENTITY:
setEntity((Component)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AmaltheaPackage.COMPONENT_EVENT__EVENT_TYPE:
setEventType(EVENT_TYPE_EDEFAULT);
return;
case AmaltheaPackage.COMPONENT_EVENT__ENTITY:
setEntity((Component)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AmaltheaPackage.COMPONENT_EVENT__EVENT_TYPE:
return eventType != EVENT_TYPE_EDEFAULT;
case AmaltheaPackage.COMPONENT_EVENT__ENTITY:
return entity != 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(" (eventType: ");
result.append(eventType);
result.append(')');
return result.toString();
}
} //ComponentEventImpl