/** | |
* Copyright (c) 2016 CEA LIST. | |
* | |
* 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 | |
* | |
*/ | |
package org.eclipse.efm.formalml.impl; | |
import org.eclipse.efm.formalml.DirectedPort; | |
import org.eclipse.efm.formalml.PortDirectionKind; | |
import org.eclipse.efm.formalml.formalmlPackage; | |
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.emf.ecore.impl.MinimalEObjectImpl; | |
import org.eclipse.uml2.uml.Port; | |
/** | |
* <!-- begin-user-doc --> | |
* An implementation of the model object '<em><b>Directed Port</b></em>'. | |
* <!-- end-user-doc --> | |
* <p> | |
* The following features are implemented: | |
* </p> | |
* <ul> | |
* <li>{@link org.eclipse.efm.formalml.impl.DirectedPortImpl#getBasePort <em>Base Port</em>}</li> | |
* <li>{@link org.eclipse.efm.formalml.impl.DirectedPortImpl#getDirection <em>Direction</em>}</li> | |
* </ul> | |
* | |
* @generated | |
*/ | |
public class DirectedPortImpl extends MinimalEObjectImpl.Container implements DirectedPort { | |
/** | |
* The cached value of the '{@link #getBasePort() <em>Base Port</em>}' reference. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getBasePort() | |
* @generated | |
* @ordered | |
*/ | |
protected Port basePort; | |
/** | |
* The default value of the '{@link #getDirection() <em>Direction</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getDirection() | |
* @generated | |
* @ordered | |
*/ | |
protected static final PortDirectionKind DIRECTION_EDEFAULT = PortDirectionKind.INOUT; | |
/** | |
* The cached value of the '{@link #getDirection() <em>Direction</em>}' attribute. | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @see #getDirection() | |
* @generated | |
* @ordered | |
*/ | |
protected PortDirectionKind direction = DIRECTION_EDEFAULT; | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
protected DirectedPortImpl() { | |
super(); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
protected EClass eStaticClass() { | |
return formalmlPackage.Literals.DIRECTED_PORT; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Port getBasePort() { | |
if (basePort != null && basePort.eIsProxy()) { | |
InternalEObject oldBasePort = (InternalEObject)basePort; | |
basePort = (Port)eResolveProxy(oldBasePort); | |
if (basePort != oldBasePort) { | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.RESOLVE, formalmlPackage.DIRECTED_PORT__BASE_PORT, oldBasePort, basePort)); | |
} | |
} | |
return basePort; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public Port basicGetBasePort() { | |
return basePort; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setBasePort(Port newBasePort) { | |
Port oldBasePort = basePort; | |
basePort = newBasePort; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, formalmlPackage.DIRECTED_PORT__BASE_PORT, oldBasePort, basePort)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public PortDirectionKind getDirection() { | |
return direction; | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
public void setDirection(PortDirectionKind newDirection) { | |
PortDirectionKind oldDirection = direction; | |
direction = newDirection == null ? DIRECTION_EDEFAULT : newDirection; | |
if (eNotificationRequired()) | |
eNotify(new ENotificationImpl(this, Notification.SET, formalmlPackage.DIRECTED_PORT__DIRECTION, oldDirection, direction)); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public Object eGet(int featureID, boolean resolve, boolean coreType) { | |
switch (featureID) { | |
case formalmlPackage.DIRECTED_PORT__BASE_PORT: | |
if (resolve) return getBasePort(); | |
return basicGetBasePort(); | |
case formalmlPackage.DIRECTED_PORT__DIRECTION: | |
return getDirection(); | |
} | |
return super.eGet(featureID, resolve, coreType); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eSet(int featureID, Object newValue) { | |
switch (featureID) { | |
case formalmlPackage.DIRECTED_PORT__BASE_PORT: | |
setBasePort((Port)newValue); | |
return; | |
case formalmlPackage.DIRECTED_PORT__DIRECTION: | |
setDirection((PortDirectionKind)newValue); | |
return; | |
} | |
super.eSet(featureID, newValue); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public void eUnset(int featureID) { | |
switch (featureID) { | |
case formalmlPackage.DIRECTED_PORT__BASE_PORT: | |
setBasePort((Port)null); | |
return; | |
case formalmlPackage.DIRECTED_PORT__DIRECTION: | |
setDirection(DIRECTION_EDEFAULT); | |
return; | |
} | |
super.eUnset(featureID); | |
} | |
/** | |
* <!-- begin-user-doc --> | |
* <!-- end-user-doc --> | |
* @generated | |
*/ | |
@Override | |
public boolean eIsSet(int featureID) { | |
switch (featureID) { | |
case formalmlPackage.DIRECTED_PORT__BASE_PORT: | |
return basePort != null; | |
case formalmlPackage.DIRECTED_PORT__DIRECTION: | |
return direction != DIRECTION_EDEFAULT; | |
} | |
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(" (direction: "); | |
result.append(direction); | |
result.append(')'); | |
return result.toString(); | |
} | |
} //DirectedPortImpl |