/**
* <copyright>
* </copyright>
*
* $Id$
*/
package org.roxgt.impl;
import java.util.Collection;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;
import org.eclipse.emf.common.util.EList;
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.EObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
import org.roxgt.Edge;
import org.roxgt.Node;
import org.roxgt.Property;
import org.roxgt.RoxgtPackage;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Edge</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* <ul>
* <li>{@link org.roxgt.impl.EdgeImpl#getLabel <em>Label</em>}</li>
* <li>{@link org.roxgt.impl.EdgeImpl#getProperties <em>Properties</em>}</li>
* <li>{@link org.roxgt.impl.EdgeImpl#getSource <em>Source</em>}</li>
* <li>{@link org.roxgt.impl.EdgeImpl#getTarget <em>Target</em>}</li>
* </ul>
* </p>
*
* @generated
*/
public class EdgeImpl extends EObjectImpl implements Edge {
/**
* The default value of the '{@link #getLabel() <em>Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabel()
* @generated
* @ordered
*/
protected static final String LABEL_EDEFAULT = null;
/**
* The cached value of the '{@link #getLabel() <em>Label</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getLabel()
* @generated
* @ordered
*/
protected String label = LABEL_EDEFAULT;
/**
* The cached value of the '{@link #getProperties() <em>Properties</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getProperties()
* @generated
* @ordered
*/
protected EList<Property> properties;
/**
* 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 EdgeImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return RoxgtPackage.Literals.EDGE;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getLabel() {
return label;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setLabel(String newLabel) {
String oldLabel = label;
label = newLabel;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, RoxgtPackage.EDGE__LABEL, oldLabel, label));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Property> getProperties() {
if (properties == null) {
properties = new EObjectContainmentEList<Property>(Property.class, this, RoxgtPackage.EDGE__PROPERTIES);
}
return properties;
}
/**
* <!-- 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, RoxgtPackage.EDGE__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, RoxgtPackage.EDGE__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, RoxgtPackage.EDGE__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, RoxgtPackage.EDGE__TARGET, oldTarget, target));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case RoxgtPackage.EDGE__PROPERTIES:
return ((InternalEList<?>)getProperties()).basicRemove(otherEnd, 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 RoxgtPackage.EDGE__LABEL:
return getLabel();
case RoxgtPackage.EDGE__PROPERTIES:
return getProperties();
case RoxgtPackage.EDGE__SOURCE:
if (resolve) return getSource();
return basicGetSource();
case RoxgtPackage.EDGE__TARGET:
if (resolve) return getTarget();
return basicGetTarget();
}
return super.eGet(featureID, resolve, coreType);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@SuppressWarnings("unchecked")
@Override
public void eSet(int featureID, Object newValue) {
switch (featureID) {
case RoxgtPackage.EDGE__LABEL:
setLabel((String)newValue);
return;
case RoxgtPackage.EDGE__PROPERTIES:
getProperties().clear();
getProperties().addAll((Collection<? extends Property>)newValue);
return;
case RoxgtPackage.EDGE__SOURCE:
setSource((Node)newValue);
return;
case RoxgtPackage.EDGE__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 RoxgtPackage.EDGE__LABEL:
setLabel(LABEL_EDEFAULT);
return;
case RoxgtPackage.EDGE__PROPERTIES:
getProperties().clear();
return;
case RoxgtPackage.EDGE__SOURCE:
setSource((Node)null);
return;
case RoxgtPackage.EDGE__TARGET:
setTarget((Node)null);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case RoxgtPackage.EDGE__LABEL:
return LABEL_EDEFAULT == null ? label != null : !LABEL_EDEFAULT.equals(label);
case RoxgtPackage.EDGE__PROPERTIES:
return properties != null && !properties.isEmpty();
case RoxgtPackage.EDGE__SOURCE:
return source != null;
case RoxgtPackage.EDGE__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(" (label: ");
result.append(label);
result.append(')');
return result.toString();
}
} //EdgeImpl