blob: 682d4a419f84fa84107dc477c67546b05c89cbdd [file] [log] [blame]
/**
*/
package org.hl7.fhir.impl;
import java.util.Collection;
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.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.hl7.fhir.FhirPackage;
import org.hl7.fhir.TestScriptAction;
import org.hl7.fhir.TestScriptMetadata;
import org.hl7.fhir.TestScriptSetup;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Test Script Setup</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link org.hl7.fhir.impl.TestScriptSetupImpl#getMetadata <em>Metadata</em>}</li>
* <li>{@link org.hl7.fhir.impl.TestScriptSetupImpl#getAction <em>Action</em>}</li>
* </ul>
*
* @generated
*/
public class TestScriptSetupImpl extends BackboneElementImpl implements TestScriptSetup {
/**
* The cached value of the '{@link #getMetadata() <em>Metadata</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getMetadata()
* @generated
* @ordered
*/
protected TestScriptMetadata metadata;
/**
* The cached value of the '{@link #getAction() <em>Action</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getAction()
* @generated
* @ordered
*/
protected EList<TestScriptAction> action;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TestScriptSetupImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return FhirPackage.eINSTANCE.getTestScriptSetup();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TestScriptMetadata getMetadata() {
return metadata;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetMetadata(TestScriptMetadata newMetadata, NotificationChain msgs) {
TestScriptMetadata oldMetadata = metadata;
metadata = newMetadata;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FhirPackage.TEST_SCRIPT_SETUP__METADATA, oldMetadata, newMetadata);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setMetadata(TestScriptMetadata newMetadata) {
if (newMetadata != metadata) {
NotificationChain msgs = null;
if (metadata != null)
msgs = ((InternalEObject)metadata).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FhirPackage.TEST_SCRIPT_SETUP__METADATA, null, msgs);
if (newMetadata != null)
msgs = ((InternalEObject)newMetadata).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FhirPackage.TEST_SCRIPT_SETUP__METADATA, null, msgs);
msgs = basicSetMetadata(newMetadata, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, FhirPackage.TEST_SCRIPT_SETUP__METADATA, newMetadata, newMetadata));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<TestScriptAction> getAction() {
if (action == null) {
action = new EObjectContainmentEList<TestScriptAction>(TestScriptAction.class, this, FhirPackage.TEST_SCRIPT_SETUP__ACTION);
}
return action;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case FhirPackage.TEST_SCRIPT_SETUP__METADATA:
return basicSetMetadata(null, msgs);
case FhirPackage.TEST_SCRIPT_SETUP__ACTION:
return ((InternalEList<?>)getAction()).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 FhirPackage.TEST_SCRIPT_SETUP__METADATA:
return getMetadata();
case FhirPackage.TEST_SCRIPT_SETUP__ACTION:
return getAction();
}
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 FhirPackage.TEST_SCRIPT_SETUP__METADATA:
setMetadata((TestScriptMetadata)newValue);
return;
case FhirPackage.TEST_SCRIPT_SETUP__ACTION:
getAction().clear();
getAction().addAll((Collection<? extends TestScriptAction>)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case FhirPackage.TEST_SCRIPT_SETUP__METADATA:
setMetadata((TestScriptMetadata)null);
return;
case FhirPackage.TEST_SCRIPT_SETUP__ACTION:
getAction().clear();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case FhirPackage.TEST_SCRIPT_SETUP__METADATA:
return metadata != null;
case FhirPackage.TEST_SCRIPT_SETUP__ACTION:
return action != null && !action.isEmpty();
}
return super.eIsSet(featureID);
}
} //TestScriptSetupImpl