/**
*/
package de.gebit.integrity.dsl.impl;
import de.gebit.integrity.dsl.DslPackage;
import de.gebit.integrity.dsl.NamedResult;
import de.gebit.integrity.dsl.Parameter;
import de.gebit.integrity.dsl.Test;
import de.gebit.integrity.dsl.TestDefinition;
import de.gebit.integrity.dsl.ValueOrEnumValueOrOperationCollection;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Test</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link de.gebit.integrity.dsl.impl.TestImpl#getCheckpoint <em>Checkpoint</em>}</li>
* <li>{@link de.gebit.integrity.dsl.impl.TestImpl#getDefinition <em>Definition</em>}</li>
* <li>{@link de.gebit.integrity.dsl.impl.TestImpl#getParameters <em>Parameters</em>}</li>
* <li>{@link de.gebit.integrity.dsl.impl.TestImpl#getResults <em>Results</em>}</li>
* <li>{@link de.gebit.integrity.dsl.impl.TestImpl#getResult <em>Result</em>}</li>
* </ul>
*
* @generated
*/
public class TestImpl extends SuiteStatementWithResultImpl implements Test
{
/**
* The default value of the '{@link #getCheckpoint() <em>Checkpoint</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCheckpoint()
* @generated
* @ordered
*/
protected static final String CHECKPOINT_EDEFAULT = null;
/**
* The cached value of the '{@link #getCheckpoint() <em>Checkpoint</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getCheckpoint()
* @generated
* @ordered
*/
protected String checkpoint = CHECKPOINT_EDEFAULT;
/**
* The cached value of the '{@link #getDefinition() <em>Definition</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDefinition()
* @generated
* @ordered
*/
protected TestDefinition definition;
/**
* The cached value of the '{@link #getParameters() <em>Parameters</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getParameters()
* @generated
* @ordered
*/
protected EList<Parameter> parameters;
/**
* The cached value of the '{@link #getResults() <em>Results</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getResults()
* @generated
* @ordered
*/
protected EList<NamedResult> results;
/**
* The cached value of the '{@link #getResult() <em>Result</em>}' containment reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getResult()
* @generated
* @ordered
*/
protected ValueOrEnumValueOrOperationCollection result;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected TestImpl()
{
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass()
{
return DslPackage.Literals.TEST;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getCheckpoint()
{
return checkpoint;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setCheckpoint(String newCheckpoint)
{
String oldCheckpoint = checkpoint;
checkpoint = newCheckpoint;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.TEST__CHECKPOINT, oldCheckpoint, checkpoint));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TestDefinition getDefinition()
{
if (definition != null && definition.eIsProxy())
{
InternalEObject oldDefinition = (InternalEObject)definition;
definition = (TestDefinition)eResolveProxy(oldDefinition);
if (definition != oldDefinition)
{
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, DslPackage.TEST__DEFINITION, oldDefinition, definition));
}
}
return definition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public TestDefinition basicGetDefinition()
{
return definition;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDefinition(TestDefinition newDefinition)
{
TestDefinition oldDefinition = definition;
definition = newDefinition;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.TEST__DEFINITION, oldDefinition, definition));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Parameter> getParameters()
{
if (parameters == null)
{
parameters = new EObjectContainmentEList<Parameter>(Parameter.class, this, DslPackage.TEST__PARAMETERS);
}
return parameters;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<NamedResult> getResults()
{
if (results == null)
{
results = new EObjectContainmentEList<NamedResult>(NamedResult.class, this, DslPackage.TEST__RESULTS);
}
return results;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public ValueOrEnumValueOrOperationCollection getResult()
{
return result;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetResult(ValueOrEnumValueOrOperationCollection newResult, NotificationChain msgs)
{
ValueOrEnumValueOrOperationCollection oldResult = result;
result = newResult;
if (eNotificationRequired())
{
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, DslPackage.TEST__RESULT, oldResult, newResult);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setResult(ValueOrEnumValueOrOperationCollection newResult)
{
if (newResult != result)
{
NotificationChain msgs = null;
if (result != null)
msgs = ((InternalEObject)result).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - DslPackage.TEST__RESULT, null, msgs);
if (newResult != null)
msgs = ((InternalEObject)newResult).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - DslPackage.TEST__RESULT, null, msgs);
msgs = basicSetResult(newResult, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, DslPackage.TEST__RESULT, newResult, newResult));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
{
switch (featureID)
{
case DslPackage.TEST__PARAMETERS:
return ((InternalEList<?>)getParameters()).basicRemove(otherEnd, msgs);
case DslPackage.TEST__RESULTS:
return ((InternalEList<?>)getResults()).basicRemove(otherEnd, msgs);
case DslPackage.TEST__RESULT:
return basicSetResult(null, 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 DslPackage.TEST__CHECKPOINT:
return getCheckpoint();
case DslPackage.TEST__DEFINITION:
if (resolve) return getDefinition();
return basicGetDefinition();
case DslPackage.TEST__PARAMETERS:
return getParameters();
case DslPackage.TEST__RESULTS:
return getResults();
case DslPackage.TEST__RESULT:
return getResult();
}
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 DslPackage.TEST__CHECKPOINT:
setCheckpoint((String)newValue);
return;
case DslPackage.TEST__DEFINITION:
setDefinition((TestDefinition)newValue);
return;
case DslPackage.TEST__PARAMETERS:
getParameters().clear();
getParameters().addAll((Collection<? extends Parameter>)newValue);
return;
case DslPackage.TEST__RESULTS:
getResults().clear();
getResults().addAll((Collection<? extends NamedResult>)newValue);
return;
case DslPackage.TEST__RESULT:
setResult((ValueOrEnumValueOrOperationCollection)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID)
{
switch (featureID)
{
case DslPackage.TEST__CHECKPOINT:
setCheckpoint(CHECKPOINT_EDEFAULT);
return;
case DslPackage.TEST__DEFINITION:
setDefinition((TestDefinition)null);
return;
case DslPackage.TEST__PARAMETERS:
getParameters().clear();
return;
case DslPackage.TEST__RESULTS:
getResults().clear();
return;
case DslPackage.TEST__RESULT:
setResult((ValueOrEnumValueOrOperationCollection)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID)
{
switch (featureID)
{
case DslPackage.TEST__CHECKPOINT:
return CHECKPOINT_EDEFAULT == null ? checkpoint != null : !CHECKPOINT_EDEFAULT.equals(checkpoint);
case DslPackage.TEST__DEFINITION:
return definition != null;
case DslPackage.TEST__PARAMETERS:
return parameters != null && !parameters.isEmpty();
case DslPackage.TEST__RESULTS:
return results != null && !results.isEmpty();
case DslPackage.TEST__RESULT:
return result != 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(" (checkpoint: ");
result.append(checkpoint);
result.append(')');
return result.toString();
}
} //TestImpl