/**
* <copyright>
* </copyright>
*
* $Id$
*/
package simulator.scl.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.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import simulator.scl.Action;
import simulator.scl.ConfigPackage;
import simulator.scl.Configuration;
import simulator.scl.Constant;
import simulator.scl.Mode;
import simulator.scl.Variable;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Configuration</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link simulator.scl.impl.ConfigurationImpl#getModes <em>Modes</em>}</li>
* <li>{@link simulator.scl.impl.ConfigurationImpl#getVariables <em>Variables</em>}</li>
* <li>{@link simulator.scl.impl.ConfigurationImpl#getConstants <em>Constants</em>}</li>
* <li>{@link simulator.scl.impl.ConfigurationImpl#getEvents <em>Events</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class ConfigurationImpl extends EObjectImpl implements Configuration {
/**
* The cached value of the '{@link #getModes() <em>Modes</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getModes()
* @generated
* @ordered
*/
protected EList<Mode> modes;
/**
* The cached value of the '{@link #getVariables() <em>Variables</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getVariables()
* @generated
* @ordered
*/
protected EList<Variable> variables;
/**
* The cached value of the '{@link #getConstants() <em>Constants</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getConstants()
* @generated
* @ordered
*/
protected EList<Constant> constants;
/**
* The cached value of the '{@link #getEvents() <em>Events</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEvents()
* @generated
* @ordered
*/
protected EList<Action> events;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected ConfigurationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return ConfigPackage.Literals.CONFIGURATION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Mode> getModes() {
if (modes == null) {
modes = new EObjectContainmentEList<Mode>(Mode.class, this, ConfigPackage.CONFIGURATION__MODES);
}
return modes;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Variable> getVariables() {
if (variables == null) {
variables = new EObjectContainmentEList<Variable>(Variable.class, this, ConfigPackage.CONFIGURATION__VARIABLES);
}
return variables;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Constant> getConstants() {
if (constants == null) {
constants = new EObjectContainmentEList<Constant>(Constant.class, this, ConfigPackage.CONFIGURATION__CONSTANTS);
}
return constants;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Action> getEvents() {
if (events == null) {
events = new EObjectContainmentEList<Action>(Action.class, this, ConfigPackage.CONFIGURATION__EVENTS);
}
return events;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case ConfigPackage.CONFIGURATION__MODES:
return ((InternalEList<?>)getModes()).basicRemove(otherEnd, msgs);
case ConfigPackage.CONFIGURATION__VARIABLES:
return ((InternalEList<?>)getVariables()).basicRemove(otherEnd, msgs);
case ConfigPackage.CONFIGURATION__CONSTANTS:
return ((InternalEList<?>)getConstants()).basicRemove(otherEnd, msgs);
case ConfigPackage.CONFIGURATION__EVENTS:
return ((InternalEList<?>)getEvents()).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 ConfigPackage.CONFIGURATION__MODES:
return getModes();
case ConfigPackage.CONFIGURATION__VARIABLES:
return getVariables();
case ConfigPackage.CONFIGURATION__CONSTANTS:
return getConstants();
case ConfigPackage.CONFIGURATION__EVENTS:
return getEvents();
}
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 ConfigPackage.CONFIGURATION__MODES:
getModes().clear();
getModes().addAll((Collection<? extends Mode>)newValue);
return;
case ConfigPackage.CONFIGURATION__VARIABLES:
getVariables().clear();
getVariables().addAll((Collection<? extends Variable>)newValue);
return;
case ConfigPackage.CONFIGURATION__CONSTANTS:
getConstants().clear();
getConstants().addAll((Collection<? extends Constant>)newValue);
return;
case ConfigPackage.CONFIGURATION__EVENTS:
getEvents().clear();
getEvents().addAll((Collection<? extends Action>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ConfigPackage.CONFIGURATION__MODES:
getModes().clear();
return;
case ConfigPackage.CONFIGURATION__VARIABLES:
getVariables().clear();
return;
case ConfigPackage.CONFIGURATION__CONSTANTS:
getConstants().clear();
return;
case ConfigPackage.CONFIGURATION__EVENTS:
getEvents().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ConfigPackage.CONFIGURATION__MODES:
return modes != null && !modes.isEmpty();
case ConfigPackage.CONFIGURATION__VARIABLES:
return variables != null && !variables.isEmpty();
case ConfigPackage.CONFIGURATION__CONSTANTS:
return constants != null && !constants.isEmpty();
case ConfigPackage.CONFIGURATION__EVENTS:
return events != null && !events.isEmpty();
}
return super.eIsSet(featureID);
}
} //ConfigurationImpl