blob: 25724e9f1bfb8a8b8eab7d80729e6f1ce65e7b97 [file] [log] [blame]
/**
* Copyright (c) 2013 itemis AG and others.
* 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:
* Mark Broerkens - initial API and implementation
*
*/
package org.eclipse.rmf.reqif10.impl;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.rmf.reqif10.ReqIF10Package;
import org.eclipse.rmf.reqif10.SpecObject;
import org.eclipse.rmf.reqif10.SpecRelation;
import org.eclipse.rmf.reqif10.SpecRelationType;
/**
* <!-- begin-user-doc --> An implementation of the model object '<em><b>Spec Relation</b></em>'. <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.rmf.reqif10.impl.SpecRelationImpl#getTarget <em>Target</em>}</li>
* <li>{@link org.eclipse.rmf.reqif10.impl.SpecRelationImpl#getSource <em>Source</em>}</li>
* <li>{@link org.eclipse.rmf.reqif10.impl.SpecRelationImpl#getType <em>Type</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class SpecRelationImpl extends SpecElementWithAttributesImpl implements SpecRelation {
/**
* The cached value of the '{@link #getTarget() <em>Target</em>}' reference. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @see #getTarget()
* @generated
* @ordered
*/
protected SpecObject target;
/**
* This is true if the Target reference has been set. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
protected boolean targetESet;
/**
* The cached value of the '{@link #getSource() <em>Source</em>}' reference. <!-- begin-user-doc --> <!--
* end-user-doc -->
*
* @see #getSource()
* @generated
* @ordered
*/
protected SpecObject source;
/**
* This is true if the Source reference has been set. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
protected boolean sourceESet;
/**
* The cached value of the '{@link #getType() <em>Type</em>}' reference. <!-- begin-user-doc --> <!-- end-user-doc
* -->
*
* @see #getType()
* @generated
* @ordered
*/
protected SpecRelationType type;
/**
* This is true if the Type reference has been set. <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
* @ordered
*/
protected boolean typeESet;
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
protected SpecRelationImpl() {
super();
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
protected EClass eStaticClass() {
return ReqIF10Package.Literals.SPEC_RELATION;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public SpecObject getTarget() {
if (target != null && target.eIsProxy()) {
InternalEObject oldTarget = (InternalEObject) target;
target = (SpecObject) eResolveProxy(oldTarget);
if (target != oldTarget) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReqIF10Package.SPEC_RELATION__TARGET, oldTarget, target));
}
}
return target;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public SpecObject basicGetTarget() {
return target;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void setTarget(SpecObject newTarget) {
SpecObject oldTarget = target;
target = newTarget;
boolean oldTargetESet = targetESet;
targetESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReqIF10Package.SPEC_RELATION__TARGET, oldTarget, target, !oldTargetESet));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void unsetTarget() {
SpecObject oldTarget = target;
boolean oldTargetESet = targetESet;
target = null;
targetESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.SPEC_RELATION__TARGET, oldTarget, null, oldTargetESet));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public boolean isSetTarget() {
return targetESet;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public SpecObject getSource() {
if (source != null && source.eIsProxy()) {
InternalEObject oldSource = (InternalEObject) source;
source = (SpecObject) eResolveProxy(oldSource);
if (source != oldSource) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReqIF10Package.SPEC_RELATION__SOURCE, oldSource, source));
}
}
return source;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public SpecObject basicGetSource() {
return source;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void setSource(SpecObject newSource) {
SpecObject oldSource = source;
source = newSource;
boolean oldSourceESet = sourceESet;
sourceESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReqIF10Package.SPEC_RELATION__SOURCE, oldSource, source, !oldSourceESet));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void unsetSource() {
SpecObject oldSource = source;
boolean oldSourceESet = sourceESet;
source = null;
sourceESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.SPEC_RELATION__SOURCE, oldSource, null, oldSourceESet));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public boolean isSetSource() {
return sourceESet;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public SpecRelationType getType() {
if (type != null && type.eIsProxy()) {
InternalEObject oldType = (InternalEObject) type;
type = (SpecRelationType) eResolveProxy(oldType);
if (type != oldType) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, ReqIF10Package.SPEC_RELATION__TYPE, oldType, type));
}
}
return type;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public SpecRelationType basicGetType() {
return type;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void setType(SpecRelationType newType) {
SpecRelationType oldType = type;
type = newType;
boolean oldTypeESet = typeESet;
typeESet = true;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, ReqIF10Package.SPEC_RELATION__TYPE, oldType, type, !oldTypeESet));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public void unsetType() {
SpecRelationType oldType = type;
boolean oldTypeESet = typeESet;
type = null;
typeESet = false;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.UNSET, ReqIF10Package.SPEC_RELATION__TYPE, oldType, null, oldTypeESet));
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
public boolean isSetType() {
return typeESet;
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case ReqIF10Package.SPEC_RELATION__TARGET:
if (resolve)
return getTarget();
return basicGetTarget();
case ReqIF10Package.SPEC_RELATION__SOURCE:
if (resolve)
return getSource();
return basicGetSource();
case ReqIF10Package.SPEC_RELATION__TYPE:
if (resolve)
return getType();
return basicGetType();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case ReqIF10Package.SPEC_RELATION__TARGET:
setTarget((SpecObject) newValue);
return;
case ReqIF10Package.SPEC_RELATION__SOURCE:
setSource((SpecObject) newValue);
return;
case ReqIF10Package.SPEC_RELATION__TYPE:
setType((SpecRelationType) newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case ReqIF10Package.SPEC_RELATION__TARGET:
unsetTarget();
return;
case ReqIF10Package.SPEC_RELATION__SOURCE:
unsetSource();
return;
case ReqIF10Package.SPEC_RELATION__TYPE:
unsetType();
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc --> <!-- end-user-doc -->
*
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case ReqIF10Package.SPEC_RELATION__TARGET:
return isSetTarget();
case ReqIF10Package.SPEC_RELATION__SOURCE:
return isSetSource();
case ReqIF10Package.SPEC_RELATION__TYPE:
return isSetType();
}
return super.eIsSet(featureID);
}
} // SpecRelationImpl