blob: d84fd4e134ede3d88fdab3530ce362b3711553b9 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2015 Willink Transformations 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:
* E.D.Willink - initial API and implementation
*******************************************************************************/
/**
*/
package manualuml2rdbms.uml.impl;
import manualuml2rdbms.uml.Association;
import manualuml2rdbms.uml.UMLPackage;
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;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Association</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link manualuml2rdbms.uml.impl.AssociationImpl#getSource <em>Source</em>}</li>
* <li>{@link manualuml2rdbms.uml.impl.AssociationImpl#getDestination <em>Destination</em>}</li>
* </ul>
*
* @generated
*/
public class AssociationImpl extends PackageElementImpl implements Association {
/**
* The cached value of the '{@link #getSource() <em>Source</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSource()
* @generated
* @ordered
*/
protected manualuml2rdbms.uml.Class source;
/**
* The cached value of the '{@link #getDestination() <em>Destination</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getDestination()
* @generated
* @ordered
*/
protected manualuml2rdbms.uml.Class destination;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected AssociationImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return UMLPackage.Literals.ASSOCIATION;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public manualuml2rdbms.uml.Class getSource() {
if (source != null && source.eIsProxy()) {
InternalEObject oldSource = (InternalEObject)source;
source = (manualuml2rdbms.uml.Class)eResolveProxy(oldSource);
if (source != oldSource) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, UMLPackage.ASSOCIATION__SOURCE, oldSource, source));
}
}
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public manualuml2rdbms.uml.Class basicGetSource() {
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public NotificationChain basicSetSource(manualuml2rdbms.uml.Class newSource, NotificationChain msgs) {
manualuml2rdbms.uml.Class oldSource = source;
source = newSource;
if (eNotificationRequired()) {
ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, UMLPackage.ASSOCIATION__SOURCE, oldSource, newSource);
if (msgs == null) msgs = notification; else msgs.add(notification);
}
return msgs;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSource(manualuml2rdbms.uml.Class newSource) {
if (newSource != source) {
NotificationChain msgs = null;
if (source != null)
msgs = ((InternalEObject)source).eInverseRemove(this, UMLPackage.CLASS__FORWARD, manualuml2rdbms.uml.Class.class, msgs);
if (newSource != null)
msgs = ((InternalEObject)newSource).eInverseAdd(this, UMLPackage.CLASS__FORWARD, manualuml2rdbms.uml.Class.class, msgs);
msgs = basicSetSource(newSource, msgs);
if (msgs != null) msgs.dispatch();
}
else if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UMLPackage.ASSOCIATION__SOURCE, newSource, newSource));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public manualuml2rdbms.uml.Class getDestination() {
if (destination != null && destination.eIsProxy()) {
InternalEObject oldDestination = (InternalEObject)destination;
destination = (manualuml2rdbms.uml.Class)eResolveProxy(oldDestination);
if (destination != oldDestination) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, UMLPackage.ASSOCIATION__DESTINATION, oldDestination, destination));
}
}
return destination;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public manualuml2rdbms.uml.Class basicGetDestination() {
return destination;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setDestination(manualuml2rdbms.uml.Class newDestination) {
manualuml2rdbms.uml.Class oldDestination = destination;
destination = newDestination;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, UMLPackage.ASSOCIATION__DESTINATION, oldDestination, destination));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case UMLPackage.ASSOCIATION__SOURCE:
if (source != null)
msgs = ((InternalEObject)source).eInverseRemove(this, UMLPackage.CLASS__FORWARD, manualuml2rdbms.uml.Class.class, msgs);
return basicSetSource((manualuml2rdbms.uml.Class)otherEnd, msgs);
}
return super.eInverseAdd(otherEnd, featureID, msgs);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case UMLPackage.ASSOCIATION__SOURCE:
return basicSetSource(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 UMLPackage.ASSOCIATION__SOURCE:
if (resolve) return getSource();
return basicGetSource();
case UMLPackage.ASSOCIATION__DESTINATION:
if (resolve) return getDestination();
return basicGetDestination();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case UMLPackage.ASSOCIATION__SOURCE:
setSource((manualuml2rdbms.uml.Class)newValue);
return;
case UMLPackage.ASSOCIATION__DESTINATION:
setDestination((manualuml2rdbms.uml.Class)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case UMLPackage.ASSOCIATION__SOURCE:
setSource((manualuml2rdbms.uml.Class)null);
return;
case UMLPackage.ASSOCIATION__DESTINATION:
setDestination((manualuml2rdbms.uml.Class)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case UMLPackage.ASSOCIATION__SOURCE:
return source != null;
case UMLPackage.ASSOCIATION__DESTINATION:
return destination != null;
}
return super.eIsSet(featureID);
}
} //AssociationImpl