/**
*/
package org.eclipse.gmf.tooling.examples.linklf.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.gmf.tooling.examples.linklf.LabeledLink;
import org.eclipse.gmf.tooling.examples.linklf.LinklfPackage;
import org.eclipse.gmf.tooling.examples.linklf.Node;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Labeled Link</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.eclipse.gmf.tooling.examples.linklf.impl.LabeledLinkImpl#getSourceName <em>Source Name</em>}</li>
* <li>{@link org.eclipse.gmf.tooling.examples.linklf.impl.LabeledLinkImpl#getLinkName <em>Link Name</em>}</li>
* <li>{@link org.eclipse.gmf.tooling.examples.linklf.impl.LabeledLinkImpl#getTargetName <em>Target Name</em>}</li>
* <li>{@link org.eclipse.gmf.tooling.examples.linklf.impl.LabeledLinkImpl#getSource <em>Source</em>}</li>
* <li>{@link org.eclipse.gmf.tooling.examples.linklf.impl.LabeledLinkImpl#getTarget <em>Target</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class LabeledLinkImpl extends CanvasElementImpl implements LabeledLink {
/**
* The default value of the '{@link #getSourceName() <em>Source Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSourceName()
* @generated
* @ordered
*/
protected static final String SOURCE_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getSourceName() <em>Source Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSourceName()
* @generated
* @ordered
*/
protected String sourceName = SOURCE_NAME_EDEFAULT;
/**
* The default value of the '{@link #getLinkName() <em>Link Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLinkName()
* @generated
* @ordered
*/
protected static final String LINK_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getLinkName() <em>Link Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLinkName()
* @generated
* @ordered
*/
protected String linkName = LINK_NAME_EDEFAULT;
/**
* The default value of the '{@link #getTargetName() <em>Target Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTargetName()
* @generated
* @ordered
*/
protected static final String TARGET_NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getTargetName() <em>Target Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTargetName()
* @generated
* @ordered
*/
protected String targetName = TARGET_NAME_EDEFAULT;
/**
* The cached value of the '{@link #getSource() <em>Source</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getSource()
* @generated
* @ordered
*/
protected Node source;
/**
* The cached value of the '{@link #getTarget() <em>Target</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTarget()
* @generated
* @ordered
*/
protected Node target;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected LabeledLinkImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return LinklfPackage.Literals.LABELED_LINK;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getSourceName() {
return sourceName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSourceName(String newSourceName) {
String oldSourceName = sourceName;
sourceName = newSourceName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LinklfPackage.LABELED_LINK__SOURCE_NAME, oldSourceName, sourceName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLinkName() {
return linkName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLinkName(String newLinkName) {
String oldLinkName = linkName;
linkName = newLinkName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LinklfPackage.LABELED_LINK__LINK_NAME, oldLinkName, linkName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getTargetName() {
return targetName;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTargetName(String newTargetName) {
String oldTargetName = targetName;
targetName = newTargetName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LinklfPackage.LABELED_LINK__TARGET_NAME, oldTargetName, targetName));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Node getSource() {
if (source != null && source.eIsProxy()) {
InternalEObject oldSource = (InternalEObject)source;
source = (Node)eResolveProxy(oldSource);
if (source != oldSource) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, LinklfPackage.LABELED_LINK__SOURCE, oldSource, source));
}
}
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Node basicGetSource() {
return source;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setSource(Node newSource) {
Node oldSource = source;
source = newSource;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LinklfPackage.LABELED_LINK__SOURCE, oldSource, source));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Node getTarget() {
if (target != null && target.eIsProxy()) {
InternalEObject oldTarget = (InternalEObject)target;
target = (Node)eResolveProxy(oldTarget);
if (target != oldTarget) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, LinklfPackage.LABELED_LINK__TARGET, oldTarget, target));
}
}
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Node basicGetTarget() {
return target;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTarget(Node newTarget) {
Node oldTarget = target;
target = newTarget;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, LinklfPackage.LABELED_LINK__TARGET, oldTarget, target));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public Object eGet(int featureID, boolean resolve, boolean coreType) {
switch (featureID) {
case LinklfPackage.LABELED_LINK__SOURCE_NAME:
return getSourceName();
case LinklfPackage.LABELED_LINK__LINK_NAME:
return getLinkName();
case LinklfPackage.LABELED_LINK__TARGET_NAME:
return getTargetName();
case LinklfPackage.LABELED_LINK__SOURCE:
if (resolve) return getSource();
return basicGetSource();
case LinklfPackage.LABELED_LINK__TARGET:
if (resolve) return getTarget();
return basicGetTarget();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case LinklfPackage.LABELED_LINK__SOURCE_NAME:
setSourceName((String)newValue);
return;
case LinklfPackage.LABELED_LINK__LINK_NAME:
setLinkName((String)newValue);
return;
case LinklfPackage.LABELED_LINK__TARGET_NAME:
setTargetName((String)newValue);
return;
case LinklfPackage.LABELED_LINK__SOURCE:
setSource((Node)newValue);
return;
case LinklfPackage.LABELED_LINK__TARGET:
setTarget((Node)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case LinklfPackage.LABELED_LINK__SOURCE_NAME:
setSourceName(SOURCE_NAME_EDEFAULT);
return;
case LinklfPackage.LABELED_LINK__LINK_NAME:
setLinkName(LINK_NAME_EDEFAULT);
return;
case LinklfPackage.LABELED_LINK__TARGET_NAME:
setTargetName(TARGET_NAME_EDEFAULT);
return;
case LinklfPackage.LABELED_LINK__SOURCE:
setSource((Node)null);
return;
case LinklfPackage.LABELED_LINK__TARGET:
setTarget((Node)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case LinklfPackage.LABELED_LINK__SOURCE_NAME:
return SOURCE_NAME_EDEFAULT == null ? sourceName != null : !SOURCE_NAME_EDEFAULT.equals(sourceName);
case LinklfPackage.LABELED_LINK__LINK_NAME:
return LINK_NAME_EDEFAULT == null ? linkName != null : !LINK_NAME_EDEFAULT.equals(linkName);
case LinklfPackage.LABELED_LINK__TARGET_NAME:
return TARGET_NAME_EDEFAULT == null ? targetName != null : !TARGET_NAME_EDEFAULT.equals(targetName);
case LinklfPackage.LABELED_LINK__SOURCE:
return source != null;
case LinklfPackage.LABELED_LINK__TARGET:
return target != null;
}
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(" (sourceName: ");
result.append(sourceName);
result.append(", linkName: ");
result.append(linkName);
result.append(", targetName: ");
result.append(targetName);
result.append(')');
return result.toString();
}
} //LabeledLinkImpl