blob: 4842df1827ff1f6e4e1a909b882d4d912e7ce837 [file] [log] [blame]
/**
* Copyright (c) 2016 CEA LIST.
*
* 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* CEA LIST - Initial API and implementation
*/
package org.eclipse.papyrus.moka.fmi.modeldescription.impl;
import java.util.Collection;
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.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.BasicFeatureMap;
import org.eclipse.emf.ecore.util.FeatureMap;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.papyrus.moka.fmi.modeldescription.Fmi2ScalarVariable;
import org.eclipse.papyrus.moka.fmi.modeldescription.FmiPackage;
import org.eclipse.papyrus.moka.fmi.modeldescription.ModelVariablesType;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Model Variables Type</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.eclipse.papyrus.moka.fmi.modeldescription.impl.ModelVariablesTypeImpl#getGroup <em>Group</em>}</li>
* <li>{@link org.eclipse.papyrus.moka.fmi.modeldescription.impl.ModelVariablesTypeImpl#getScalarVariable <em>Scalar Variable</em>}</li>
* </ul>
*
* @generated
*/
public class ModelVariablesTypeImpl extends MinimalEObjectImpl.Container implements ModelVariablesType {
/**
* The cached value of the '{@link #getGroup() <em>Group</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getGroup()
* @generated
* @ordered
*/
protected FeatureMap group;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ModelVariablesTypeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FmiPackage.Literals.MODEL_VARIABLES_TYPE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public FeatureMap getGroup() {
if (group == null) {
group = new BasicFeatureMap(this, FmiPackage.MODEL_VARIABLES_TYPE__GROUP);
}
return group;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Fmi2ScalarVariable> getScalarVariable() {
return getGroup().list(FmiPackage.Literals.MODEL_VARIABLES_TYPE__SCALAR_VARIABLE);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FmiPackage.MODEL_VARIABLES_TYPE__GROUP:
return ((InternalEList<?>)getGroup()).basicRemove(otherEnd, msgs);
case FmiPackage.MODEL_VARIABLES_TYPE__SCALAR_VARIABLE:
return ((InternalEList<?>)getScalarVariable()).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 FmiPackage.MODEL_VARIABLES_TYPE__GROUP:
if (coreType) return getGroup();
return ((FeatureMap.Internal)getGroup()).getWrapper();
case FmiPackage.MODEL_VARIABLES_TYPE__SCALAR_VARIABLE:
return getScalarVariable();
}
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 FmiPackage.MODEL_VARIABLES_TYPE__GROUP:
((FeatureMap.Internal)getGroup()).set(newValue);
return;
case FmiPackage.MODEL_VARIABLES_TYPE__SCALAR_VARIABLE:
getScalarVariable().clear();
getScalarVariable().addAll((Collection<? extends Fmi2ScalarVariable>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FmiPackage.MODEL_VARIABLES_TYPE__GROUP:
getGroup().clear();
return;
case FmiPackage.MODEL_VARIABLES_TYPE__SCALAR_VARIABLE:
getScalarVariable().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FmiPackage.MODEL_VARIABLES_TYPE__GROUP:
return group != null && !group.isEmpty();
case FmiPackage.MODEL_VARIABLES_TYPE__SCALAR_VARIABLE:
return !getScalarVariable().isEmpty();
}
return super.eIsSet(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public String toString() {
if (eIsProxy()) return super.toString();
StringBuffer result = new StringBuffer(super.toString());
result.append(" (group: ");
result.append(group);
result.append(')');
return result.toString();
}
} //ModelVariablesTypeImpl