blob: 358613c43f1f006850884157b91f46e132c6b679 [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.AmaltheaPackage;
import org.eclipse.app4mc.amalthea.model.HwFeature;
import org.eclipse.app4mc.amalthea.model.HwFeatureCategory;
import org.eclipse.app4mc.amalthea.model.HwFeatureType;
import org.eclipse.app4mc.amalthea.model.IDescription;
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.util.EObjectContainmentWithInverseEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Hw Feature Category</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.HwFeatureCategoryImpl#getDescription <em>Description</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.HwFeatureCategoryImpl#getFeatureType <em>Feature Type</em>}</li>
* <li>{@link org.eclipse.app4mc.amalthea.model.impl.HwFeatureCategoryImpl#getFeatures <em>Features</em>}</li>
* </ul>
*
* @generated
*/
public class HwFeatureCategoryImpl extends ReferableBaseObjectImpl implements HwFeatureCategory {
/**
* The default value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected static final String DESCRIPTION_EDEFAULT = null;
/**
* The cached value of the '{@link #getDescription() <em>Description</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDescription()
* @generated
* @ordered
*/
protected String description = DESCRIPTION_EDEFAULT;
/**
* The default value of the '{@link #getFeatureType() <em>Feature Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFeatureType()
* @generated
* @ordered
*/
protected static final HwFeatureType FEATURE_TYPE_EDEFAULT = HwFeatureType._UNDEFINED_;
/**
* The cached value of the '{@link #getFeatureType() <em>Feature Type</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFeatureType()
* @generated
* @ordered
*/
protected HwFeatureType featureType = FEATURE_TYPE_EDEFAULT;
/**
* The cached value of the '{@link #getFeatures() <em>Features</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getFeatures()
* @generated
* @ordered
*/
protected EList<HwFeature> features;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected HwFeatureCategoryImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return AmaltheaPackage.eINSTANCE.getHwFeatureCategory();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String getDescription() {
return description;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setDescription(String newDescription) {
String oldDescription = description;
description = newDescription;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.HW_FEATURE_CATEGORY__DESCRIPTION, oldDescription, description));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public HwFeatureType getFeatureType() {
return featureType;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void setFeatureType(HwFeatureType newFeatureType) {
HwFeatureType oldFeatureType = featureType;
featureType = newFeatureType == null ? FEATURE_TYPE_EDEFAULT : newFeatureType;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURE_TYPE, oldFeatureType, featureType));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public EList<HwFeature> getFeatures() {
if (features == null) {
features = new EObjectContainmentWithInverseEList<HwFeature>(HwFeature.class, this, AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURES, AmaltheaPackage.HW_FEATURE__CONTAINING_CATEGORY);
}
return features;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURES:
return ((InternalEList<InternalEObject>)(InternalEList<?>)getFeatures()).basicAdd(otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURES:
return ((InternalEList<?>)getFeatures()).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 AmaltheaPackage.HW_FEATURE_CATEGORY__DESCRIPTION:
return getDescription();
case AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURE_TYPE:
return getFeatureType();
case AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURES:
return getFeatures();
}
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.HW_FEATURE_CATEGORY__DESCRIPTION:
setDescription((String)newValue);
return;
case AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURE_TYPE:
setFeatureType((HwFeatureType)newValue);
return;
case AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURES:
getFeatures().clear();
getFeatures().addAll((Collection<? extends HwFeature>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case AmaltheaPackage.HW_FEATURE_CATEGORY__DESCRIPTION:
setDescription(DESCRIPTION_EDEFAULT);
return;
case AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURE_TYPE:
setFeatureType(FEATURE_TYPE_EDEFAULT);
return;
case AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURES:
getFeatures().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case AmaltheaPackage.HW_FEATURE_CATEGORY__DESCRIPTION:
return DESCRIPTION_EDEFAULT == null ? description != null : !DESCRIPTION_EDEFAULT.equals(description);
case AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURE_TYPE:
return featureType != FEATURE_TYPE_EDEFAULT;
case AmaltheaPackage.HW_FEATURE_CATEGORY__FEATURES:
return features != null && !features.isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public int eBaseStructuralFeatureID(int derivedFeatureID, Class<?> baseClass) {
if (baseClass == IDescription.class) {
switch (derivedFeatureID) {
case AmaltheaPackage.HW_FEATURE_CATEGORY__DESCRIPTION: return AmaltheaPackage.IDESCRIPTION__DESCRIPTION;
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 == IDescription.class) {
switch (baseFeatureID) {
case AmaltheaPackage.IDESCRIPTION__DESCRIPTION: return AmaltheaPackage.HW_FEATURE_CATEGORY__DESCRIPTION;
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(" (description: ");
result.append(description);
result.append(", featureType: ");
result.append(featureType);
result.append(')');
return result.toString();
}
} //HwFeatureCategoryImpl