| /******************************************************************************* |
| * Copyright (c) 2016 Fundación Tecnalia Research & Innovation. |
| * |
| * 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: |
| * Huascar Espinoza - initial API and implementation |
| * Alejandra Ruíz - initial API and implementation |
| * Idoya Del Río - initial API and implementation |
| * Mari Carmen Palacios - initial API and implementation |
| * Angel López - initial API and implementation |
| *******************************************************************************/ |
| /** |
| */ |
| package org.eclipse.opencert.sam.agree.agreement.impl; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.notify.NotificationChain; |
| |
| 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.MinimalEObjectImpl; |
| |
| import org.eclipse.opencert.sam.agree.agreement.AgreementPackage; |
| import org.eclipse.opencert.sam.agree.agreement.Pattern; |
| import org.eclipse.opencert.sam.agree.agreement.nonfunctional; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>Pattern</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.opencert.sam.agree.agreement.impl.PatternImpl#getPremise <em>Premise</em>}</li> |
| * <li>{@link org.eclipse.opencert.sam.agree.agreement.impl.PatternImpl#getEvent <em>Event</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class PatternImpl extends MinimalEObjectImpl.Container implements Pattern |
| { |
| /** |
| * The cached value of the '{@link #getPremise() <em>Premise</em>}' containment reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getPremise() |
| * @generated |
| * @ordered |
| */ |
| protected nonfunctional premise; |
| |
| /** |
| * The default value of the '{@link #getEvent() <em>Event</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEvent() |
| * @generated |
| * @ordered |
| */ |
| protected static final String EVENT_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getEvent() <em>Event</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getEvent() |
| * @generated |
| * @ordered |
| */ |
| protected String event = EVENT_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| protected PatternImpl() |
| { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() |
| { |
| return AgreementPackage.Literals.PATTERN; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public nonfunctional getPremise() |
| { |
| return premise; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetPremise(nonfunctional newPremise, NotificationChain msgs) |
| { |
| nonfunctional oldPremise = premise; |
| premise = newPremise; |
| if (eNotificationRequired()) |
| { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, AgreementPackage.PATTERN__PREMISE, oldPremise, newPremise); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setPremise(nonfunctional newPremise) |
| { |
| if (newPremise != premise) |
| { |
| NotificationChain msgs = null; |
| if (premise != null) |
| msgs = ((InternalEObject)premise).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - AgreementPackage.PATTERN__PREMISE, null, msgs); |
| if (newPremise != null) |
| msgs = ((InternalEObject)newPremise).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - AgreementPackage.PATTERN__PREMISE, null, msgs); |
| msgs = basicSetPremise(newPremise, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AgreementPackage.PATTERN__PREMISE, newPremise, newPremise)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getEvent() |
| { |
| return event; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setEvent(String newEvent) |
| { |
| String oldEvent = event; |
| event = newEvent; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, AgreementPackage.PATTERN__EVENT, oldEvent, event)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) |
| { |
| switch (featureID) |
| { |
| case AgreementPackage.PATTERN__PREMISE: |
| return basicSetPremise(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 AgreementPackage.PATTERN__PREMISE: |
| return getPremise(); |
| case AgreementPackage.PATTERN__EVENT: |
| return getEvent(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) |
| { |
| switch (featureID) |
| { |
| case AgreementPackage.PATTERN__PREMISE: |
| setPremise((nonfunctional)newValue); |
| return; |
| case AgreementPackage.PATTERN__EVENT: |
| setEvent((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) |
| { |
| switch (featureID) |
| { |
| case AgreementPackage.PATTERN__PREMISE: |
| setPremise((nonfunctional)null); |
| return; |
| case AgreementPackage.PATTERN__EVENT: |
| setEvent(EVENT_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) |
| { |
| switch (featureID) |
| { |
| case AgreementPackage.PATTERN__PREMISE: |
| return premise != null; |
| case AgreementPackage.PATTERN__EVENT: |
| return EVENT_EDEFAULT == null ? event != null : !EVENT_EDEFAULT.equals(event); |
| } |
| 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(" (Event: "); |
| result.append(event); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| } //PatternImpl |