| /** |
| * Copyright (c) 2012 EclipseSource Muenchen GmbH. |
| * |
| * 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: |
| */ |
| package org.eclipse.emf.emfstore.fuzzy.emf.config.impl; |
| |
| import java.util.Collection; |
| import java.util.Date; |
| |
| 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.impl.EObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
| import org.eclipse.emf.ecore.util.InternalEList; |
| |
| import org.eclipse.emf.emfstore.fuzzy.emf.config.ConfigPackage; |
| import org.eclipse.emf.emfstore.fuzzy.emf.config.TestConfig; |
| import org.eclipse.emf.emfstore.fuzzy.emf.config.TestResult; |
| import org.eclipse.emf.emfstore.fuzzy.emf.config.TestRun; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Test Run</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.emf.emfstore.fuzzy.emf.config.impl.TestRunImpl#getConfig <em>Config</em>}</li> |
| * <li>{@link org.eclipse.emf.emfstore.fuzzy.emf.config.impl.TestRunImpl#getTime <em>Time</em>}</li> |
| * <li>{@link org.eclipse.emf.emfstore.fuzzy.emf.config.impl.TestRunImpl#getResults <em>Results</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class TestRunImpl extends EObjectImpl implements TestRun { |
| /** |
| * The cached value of the '{@link #getConfig() <em>Config</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getConfig() |
| * @generated |
| * @ordered |
| */ |
| protected TestConfig config; |
| |
| /** |
| * The default value of the '{@link #getTime() <em>Time</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getTime() |
| * @generated |
| * @ordered |
| */ |
| protected static final Date TIME_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getTime() <em>Time</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @see #getTime() |
| * @generated |
| * @ordered |
| */ |
| protected Date time = TIME_EDEFAULT; |
| |
| /** |
| * 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<TestResult> results; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| protected TestRunImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return ConfigPackage.Literals.TEST_RUN; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public TestConfig getConfig() { |
| return config; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public NotificationChain basicSetConfig(TestConfig newConfig, NotificationChain msgs) { |
| TestConfig oldConfig = config; |
| config = newConfig; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, |
| ConfigPackage.TEST_RUN__CONFIG, oldConfig, newConfig); |
| if (msgs == null) |
| msgs = notification; |
| else |
| msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setConfig(TestConfig newConfig) { |
| if (newConfig != config) { |
| NotificationChain msgs = null; |
| if (config != null) |
| msgs = ((InternalEObject) config).eInverseRemove(this, EOPPOSITE_FEATURE_BASE |
| - ConfigPackage.TEST_RUN__CONFIG, null, msgs); |
| if (newConfig != null) |
| msgs = ((InternalEObject) newConfig).eInverseAdd(this, EOPPOSITE_FEATURE_BASE |
| - ConfigPackage.TEST_RUN__CONFIG, null, msgs); |
| msgs = basicSetConfig(newConfig, msgs); |
| if (msgs != null) |
| msgs.dispatch(); |
| } else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.TEST_RUN__CONFIG, newConfig, newConfig)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public Date getTime() { |
| return time; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public void setTime(Date newTime) { |
| Date oldTime = time; |
| time = newTime; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, ConfigPackage.TEST_RUN__TIME, oldTime, time)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| public EList<TestResult> getResults() { |
| if (results == null) { |
| results = new EObjectContainmentEList<TestResult>(TestResult.class, this, ConfigPackage.TEST_RUN__RESULTS); |
| } |
| return results; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case ConfigPackage.TEST_RUN__CONFIG: |
| return basicSetConfig(null, msgs); |
| case ConfigPackage.TEST_RUN__RESULTS: |
| return ((InternalEList<?>) getResults()).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.TEST_RUN__CONFIG: |
| return getConfig(); |
| case ConfigPackage.TEST_RUN__TIME: |
| return getTime(); |
| case ConfigPackage.TEST_RUN__RESULTS: |
| return getResults(); |
| } |
| 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.TEST_RUN__CONFIG: |
| setConfig((TestConfig) newValue); |
| return; |
| case ConfigPackage.TEST_RUN__TIME: |
| setTime((Date) newValue); |
| return; |
| case ConfigPackage.TEST_RUN__RESULTS: |
| getResults().clear(); |
| getResults().addAll((Collection<? extends TestResult>) newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case ConfigPackage.TEST_RUN__CONFIG: |
| setConfig((TestConfig) null); |
| return; |
| case ConfigPackage.TEST_RUN__TIME: |
| setTime(TIME_EDEFAULT); |
| return; |
| case ConfigPackage.TEST_RUN__RESULTS: |
| getResults().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case ConfigPackage.TEST_RUN__CONFIG: |
| return config != null; |
| case ConfigPackage.TEST_RUN__TIME: |
| return TIME_EDEFAULT == null ? time != null : !TIME_EDEFAULT.equals(time); |
| case ConfigPackage.TEST_RUN__RESULTS: |
| return results != null && !results.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(" (time: "); |
| result.append(time); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } // TestRunImpl |