| /** |
| * Copyright (c) 2014 Fraunhofer FOKUS |
| * 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: |
| * Marc-Florian Wendland |
| */ |
| package org.eclipse.upr.utp.impl; |
| |
| 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.EObject; |
| 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.EDataTypeUniqueEList; |
| import org.eclipse.emf.ecore.util.EcoreUtil; |
| |
| import org.eclipse.uml2.common.util.CacheAdapter; |
| |
| import org.eclipse.uml2.uml.ValueSpecification; |
| |
| import org.eclipse.upr.utp.TestObjectiveSpecification; |
| import org.eclipse.upr.utp.UTPPackage; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Test Objective Specification</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.upr.utp.impl.TestObjectiveSpecificationImpl#getBase_Class <em>Base Class</em>}</li> |
| * <li>{@link org.eclipse.upr.utp.impl.TestObjectiveSpecificationImpl#getId <em>Id</em>}</li> |
| * <li>{@link org.eclipse.upr.utp.impl.TestObjectiveSpecificationImpl#getSpecification <em>Specification</em>}</li> |
| * <li>{@link org.eclipse.upr.utp.impl.TestObjectiveSpecificationImpl#getPriority <em>Priority</em>}</li> |
| * <li>{@link org.eclipse.upr.utp.impl.TestObjectiveSpecificationImpl#getReferences <em>References</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class TestObjectiveSpecificationImpl extends EObjectImpl implements TestObjectiveSpecification { |
| /** |
| * The cached value of the '{@link #getBase_Class() <em>Base Class</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getBase_Class() |
| * @generated |
| * @ordered |
| */ |
| protected org.eclipse.uml2.uml.Class base_Class; |
| |
| /** |
| * The default value of the '{@link #getId() <em>Id</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected static final String ID_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getId() <em>Id</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getId() |
| * @generated |
| * @ordered |
| */ |
| protected String id = ID_EDEFAULT; |
| |
| /** |
| * The default value of the '{@link #getSpecification() <em>Specification</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSpecification() |
| * @generated |
| * @ordered |
| */ |
| protected static final String SPECIFICATION_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getSpecification() <em>Specification</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getSpecification() |
| * @generated |
| * @ordered |
| */ |
| protected String specification = SPECIFICATION_EDEFAULT; |
| |
| /** |
| * The cached value of the '{@link #getPriority() <em>Priority</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPriority() |
| * @generated |
| * @ordered |
| */ |
| protected ValueSpecification priority; |
| |
| /** |
| * The cached value of the '{@link #getReferences() <em>References</em>}' attribute list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getReferences() |
| * @generated |
| * @ordered |
| */ |
| protected EList<String> references; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected TestObjectiveSpecificationImpl() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return UTPPackage.Literals.TEST_OBJECTIVE_SPECIFICATION; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.uml2.uml.Class getBase_Class() { |
| if (base_Class != null && base_Class.eIsProxy()) { |
| InternalEObject oldBase_Class = (InternalEObject)base_Class; |
| base_Class = (org.eclipse.uml2.uml.Class)eResolveProxy(oldBase_Class); |
| if (base_Class != oldBase_Class) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, UTPPackage.TEST_OBJECTIVE_SPECIFICATION__BASE_CLASS, oldBase_Class, base_Class)); |
| } |
| } |
| return base_Class; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public org.eclipse.uml2.uml.Class basicGetBase_Class() { |
| return base_Class; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setBase_Class(org.eclipse.uml2.uml.Class newBase_Class) { |
| org.eclipse.uml2.uml.Class oldBase_Class = base_Class; |
| base_Class = newBase_Class; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UTPPackage.TEST_OBJECTIVE_SPECIFICATION__BASE_CLASS, oldBase_Class, base_Class)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getId() { |
| return id; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setId(String newId) { |
| String oldId = id; |
| id = newId; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UTPPackage.TEST_OBJECTIVE_SPECIFICATION__ID, oldId, id)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getSpecification() { |
| return specification; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setSpecification(String newSpecification) { |
| String oldSpecification = specification; |
| specification = newSpecification; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UTPPackage.TEST_OBJECTIVE_SPECIFICATION__SPECIFICATION, oldSpecification, specification)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ValueSpecification getPriority() { |
| if (priority != null && priority.eIsProxy()) { |
| InternalEObject oldPriority = (InternalEObject)priority; |
| priority = (ValueSpecification)eResolveProxy(oldPriority); |
| if (priority != oldPriority) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, UTPPackage.TEST_OBJECTIVE_SPECIFICATION__PRIORITY, oldPriority, priority)); |
| } |
| } |
| return priority; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public ValueSpecification basicGetPriority() { |
| return priority; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPriority(ValueSpecification newPriority) { |
| ValueSpecification oldPriority = priority; |
| priority = newPriority; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, UTPPackage.TEST_OBJECTIVE_SPECIFICATION__PRIORITY, oldPriority, priority)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public EList<String> getReferences() { |
| if (references == null) { |
| references = new EDataTypeUniqueEList<String>(String.class, this, UTPPackage.TEST_OBJECTIVE_SPECIFICATION__REFERENCES); |
| } |
| return references; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__BASE_CLASS: |
| if (resolve) return getBase_Class(); |
| return basicGetBase_Class(); |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__ID: |
| return getId(); |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__SPECIFICATION: |
| return getSpecification(); |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__PRIORITY: |
| if (resolve) return getPriority(); |
| return basicGetPriority(); |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__REFERENCES: |
| return getReferences(); |
| } |
| 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 UTPPackage.TEST_OBJECTIVE_SPECIFICATION__BASE_CLASS: |
| setBase_Class((org.eclipse.uml2.uml.Class)newValue); |
| return; |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__ID: |
| setId((String)newValue); |
| return; |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__SPECIFICATION: |
| setSpecification((String)newValue); |
| return; |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__PRIORITY: |
| setPriority((ValueSpecification)newValue); |
| return; |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__REFERENCES: |
| getReferences().clear(); |
| getReferences().addAll((Collection<? extends String>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__BASE_CLASS: |
| setBase_Class((org.eclipse.uml2.uml.Class)null); |
| return; |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__ID: |
| setId(ID_EDEFAULT); |
| return; |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__SPECIFICATION: |
| setSpecification(SPECIFICATION_EDEFAULT); |
| return; |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__PRIORITY: |
| setPriority((ValueSpecification)null); |
| return; |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__REFERENCES: |
| getReferences().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__BASE_CLASS: |
| return base_Class != null; |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__ID: |
| return ID_EDEFAULT == null ? id != null : !ID_EDEFAULT.equals(id); |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__SPECIFICATION: |
| return SPECIFICATION_EDEFAULT == null ? specification != null : !SPECIFICATION_EDEFAULT.equals(specification); |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__PRIORITY: |
| return priority != null; |
| case UTPPackage.TEST_OBJECTIVE_SPECIFICATION__REFERENCES: |
| return references != null && !references.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(" (id: "); |
| result.append(id); |
| result.append(", specification: "); |
| result.append(specification); |
| result.append(", references: "); |
| result.append(references); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| /** |
| * Creates a new instance of the specified Ecore class. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param eClass The Ecore class of the instance to create. |
| * @return The new instance. |
| * @generated |
| */ |
| protected EObject create(EClass eClass) { |
| return EcoreUtil.create(eClass); |
| } |
| |
| /** |
| * Retrieves the cache adapter for this '<em><b>Test Objective Specification</b></em>'. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @return The cache adapter for this '<em><b>Test Objective Specification</b></em>'. |
| * @generated |
| */ |
| protected CacheAdapter getCacheAdapter() { |
| return CacheAdapter.getCacheAdapter(this); |
| } |
| |
| } //TestObjectiveSpecificationImpl |