/*******************************************************************************
* Copyright (c) 2013-2016 Jean-Marie Gauthier, University of Franche-Comte, and Samares-Engineering
* 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:
* Jean-Marie Gauthier, University of Franche-Comte - initial API and implementation
* Jean-Marie Gauthier, Samares-Engineering - Neon implementation
*******************************************************************************/
/**
*/
package edu.ufc.femtost.disc.sysml4modelica.profile.classes.impl;
import edu.ufc.femtost.disc.sysml4modelica.profile.classes.ModelicaConstrainedBy;
import edu.ufc.femtost.disc.sysml4modelica.profile.classes.classesPackage;
import java.util.Collection;
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.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
import org.eclipse.uml2.uml.Dependency;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Modelica Constrained By</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link edu.ufc.femtost.disc.sysml4modelica.profile.classes.impl.ModelicaConstrainedByImpl#getModification <em>Modification</em>}</li>
* <li>{@link edu.ufc.femtost.disc.sysml4modelica.profile.classes.impl.ModelicaConstrainedByImpl#getBase_Dependency <em>Base Dependency</em>}</li>
* </ul>
*
* @generated
*/
public class ModelicaConstrainedByImpl extends MinimalEObjectImpl.Container implements ModelicaConstrainedBy {
/**
* The cached value of the '{@link #getModification() <em>Modification</em>}' attribute list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getModification()
* @generated
* @ordered
*/
protected EList<String> modification;
/**
* The cached value of the '{@link #getBase_Dependency() <em>Base Dependency</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getBase_Dependency()
* @generated
* @ordered
*/
protected Dependency base_Dependency;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ModelicaConstrainedByImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return classesPackage.Literals.MODELICA_CONSTRAINED_BY;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<String> getModification() {
if (modification == null) {
modification = new EDataTypeUniqueEList<String>(String.class, this, classesPackage.MODELICA_CONSTRAINED_BY__MODIFICATION);
}
return modification;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Dependency getBase_Dependency() {
if (base_Dependency != null && base_Dependency.eIsProxy()) {
InternalEObject oldBase_Dependency = (InternalEObject)base_Dependency;
base_Dependency = (Dependency)eResolveProxy(oldBase_Dependency);
if (base_Dependency != oldBase_Dependency) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, classesPackage.MODELICA_CONSTRAINED_BY__BASE_DEPENDENCY, oldBase_Dependency, base_Dependency));
}
}
return base_Dependency;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Dependency basicGetBase_Dependency() {
return base_Dependency;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setBase_Dependency(Dependency newBase_Dependency) {
Dependency oldBase_Dependency = base_Dependency;
base_Dependency = newBase_Dependency;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, classesPackage.MODELICA_CONSTRAINED_BY__BASE_DEPENDENCY, oldBase_Dependency, base_Dependency));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case classesPackage.MODELICA_CONSTRAINED_BY__MODIFICATION:
return getModification();
case classesPackage.MODELICA_CONSTRAINED_BY__BASE_DEPENDENCY:
if (resolve) return getBase_Dependency();
return basicGetBase_Dependency();
}
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 classesPackage.MODELICA_CONSTRAINED_BY__MODIFICATION:
getModification().clear();
getModification().addAll((Collection<? extends String>)newValue);
return;
case classesPackage.MODELICA_CONSTRAINED_BY__BASE_DEPENDENCY:
setBase_Dependency((Dependency)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case classesPackage.MODELICA_CONSTRAINED_BY__MODIFICATION:
getModification().clear();
return;
case classesPackage.MODELICA_CONSTRAINED_BY__BASE_DEPENDENCY:
setBase_Dependency((Dependency)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case classesPackage.MODELICA_CONSTRAINED_BY__MODIFICATION:
return modification != null && !modification.isEmpty();
case classesPackage.MODELICA_CONSTRAINED_BY__BASE_DEPENDENCY:
return base_Dependency != null;
}
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(" (modification: ");
result.append(modification);
result.append(')');
return result.toString();
}
} //ModelicaConstrainedByImpl