blob: b0f35a7dfb445811f26a478a5455f48c7bd8e6e2 [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 java.util.Collection;
import org.eclipse.app4mc.amalthea.model.AmaltheaIndex;
import org.eclipse.app4mc.amalthea.model.AmaltheaPackage;
import org.eclipse.app4mc.amalthea.model.Component;
import org.eclipse.app4mc.amalthea.model.ITaggable;
import org.eclipse.app4mc.amalthea.model.OsEvent;
import org.eclipse.app4mc.amalthea.model.Tag;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.util.EObjectResolvingEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Os Event</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.OsEventImpl#getTags <em>Tags</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.OsEventImpl#getCommunicationOverheadInBit <em>Communication Overhead In Bit</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.OsEventImpl#getReferringComponents <em>Referring Components</em>}</li>
* </ul>
*
* @generated
*/
public class OsEventImpl extends ReferableBaseObjectImpl implements OsEvent {
/**
* The cached value of the '{@link #getTags() <em>Tags</em>}' reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTags()
* @generated
* @ordered
*/
protected EList<Tag> tags;
/**
* The default value of the '{@link #getCommunicationOverheadInBit() <em>Communication Overhead In Bit</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCommunicationOverheadInBit()
* @generated
* @ordered
*/
protected static final int COMMUNICATION_OVERHEAD_IN_BIT_EDEFAULT = 0;
/**
* The cached value of the '{@link #getCommunicationOverheadInBit() <em>Communication Overhead In Bit</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCommunicationOverheadInBit()
* @generated
* @ordered
*/
protected int communicationOverheadInBit = COMMUNICATION_OVERHEAD_IN_BIT_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected OsEventImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AmaltheaPackage.eINSTANCE.getOsEvent();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<Tag> getTags() {
if (tags == null) {
tags = new EObjectResolvingEList<Tag>(Tag.class, this, AmaltheaPackage.OS_EVENT__TAGS);
}
return tags;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int getCommunicationOverheadInBit() {
return communicationOverheadInBit;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setCommunicationOverheadInBit(int newCommunicationOverheadInBit) {
int oldCommunicationOverheadInBit = communicationOverheadInBit;
communicationOverheadInBit = newCommunicationOverheadInBit;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.OS_EVENT__COMMUNICATION_OVERHEAD_IN_BIT, oldCommunicationOverheadInBit, communicationOverheadInBit));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<Component> getReferringComponents() {
EReference _component_OsEvents = AmaltheaPackage.eINSTANCE.getComponent_OsEvents();
return AmaltheaIndex.<Component>getInverseReferences(this, AmaltheaPackage.eINSTANCE.getOsEvent_ReferringComponents(),
java.util.Collections.<EReference>unmodifiableSet(org.eclipse.xtext.xbase.lib.CollectionLiterals.<EReference>newHashSet(_component_OsEvents)));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case AmaltheaPackage.OS_EVENT__TAGS:
return getTags();
case AmaltheaPackage.OS_EVENT__COMMUNICATION_OVERHEAD_IN_BIT:
return getCommunicationOverheadInBit();
case AmaltheaPackage.OS_EVENT__REFERRING_COMPONENTS:
return getReferringComponents();
}
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 AmaltheaPackage.OS_EVENT__TAGS:
getTags().clear();
getTags().addAll((Collection<? extends Tag>)newValue);
return;
case AmaltheaPackage.OS_EVENT__COMMUNICATION_OVERHEAD_IN_BIT:
setCommunicationOverheadInBit((Integer)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AmaltheaPackage.OS_EVENT__TAGS:
getTags().clear();
return;
case AmaltheaPackage.OS_EVENT__COMMUNICATION_OVERHEAD_IN_BIT:
setCommunicationOverheadInBit(COMMUNICATION_OVERHEAD_IN_BIT_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AmaltheaPackage.OS_EVENT__TAGS:
return tags != null && !tags.isEmpty();
case AmaltheaPackage.OS_EVENT__COMMUNICATION_OVERHEAD_IN_BIT:
return communicationOverheadInBit != COMMUNICATION_OVERHEAD_IN_BIT_EDEFAULT;
case AmaltheaPackage.OS_EVENT__REFERRING_COMPONENTS:
return !getReferringComponents().isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == ITaggable.class) {
switch (derivedFeatureID) {
case AmaltheaPackage.OS_EVENT__TAGS: return AmaltheaPackage.ITAGGABLE__TAGS;
default: return -1;
}
}
return super.eBaseStructuralFeatureID(derivedFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eDerivedStructuralFeatureID(int baseFeatureID, Class<?> baseClass) {
if (baseClass == ITaggable.class) {
switch (baseFeatureID) {
case AmaltheaPackage.ITAGGABLE__TAGS: return AmaltheaPackage.OS_EVENT__TAGS;
default: return -1;
}
}
return super.eDerivedStructuralFeatureID(baseFeatureID, baseClass);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuilder result = new StringBuilder(super.toString());
result.append(" (communicationOverheadInBit: ");
result.append(communicationOverheadInBit);
result.append(')');
return result.toString();
}
} //OsEventImpl