blob: 6830d0e8d92128b9418976b0c0087dee4ce69d1a [file] [log] [blame]
/**
*/
package graph.impl;
import graph.Edge;
import graph.Graph;
import graph.GraphPackage;
import graph.Node;
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.EPackage;
import org.eclipse.emf.ecore.InternalEObject;
import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.MinimalEObjectImpl;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.InternalEList;
/**
* <!-- begin-user-doc -->
* An implementation of the model object '<em><b>Graph</b></em>'.
* <!-- end-user-doc -->
* <p>
* The following features are implemented:
* </p>
* <ul>
* <li>{@link graph.impl.GraphImpl#getEdges <em>Edges</em>}</li>
* <li>{@link graph.impl.GraphImpl#getNodes <em>Nodes</em>}</li>
* <li>{@link graph.impl.GraphImpl#getTypegraph <em>Typegraph</em>}</li>
* <li>{@link graph.impl.GraphImpl#getName <em>Name</em>}</li>
* </ul>
*
* @generated
*/
public class GraphImpl extends MinimalEObjectImpl.Container implements Graph {
/**
* The cached value of the '{@link #getEdges() <em>Edges</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getEdges()
* @generated
* @ordered
*/
protected EList<Edge> edges;
/**
* The cached value of the '{@link #getNodes() <em>Nodes</em>}' containment reference list.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getNodes()
* @generated
* @ordered
*/
protected EList<Node> nodes;
/**
* The cached value of the '{@link #getTypegraph() <em>Typegraph</em>}' reference.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getTypegraph()
* @generated
* @ordered
*/
protected EPackage typegraph;
/**
* The default value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected static final String NAME_EDEFAULT = null;
/**
* The cached value of the '{@link #getName() <em>Name</em>}' attribute.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @see #getName()
* @generated
* @ordered
*/
protected String name = NAME_EDEFAULT;
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected GraphImpl() {
super();
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
protected EClass eStaticClass() {
return GraphPackage.Literals.GRAPH;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Edge> getEdges() {
if (edges == null) {
edges = new EObjectContainmentEList<Edge>(Edge.class, this, GraphPackage.GRAPH__EDGES);
}
return edges;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EList<Node> getNodes() {
if (nodes == null) {
nodes = new EObjectContainmentEList<Node>(Node.class, this, GraphPackage.GRAPH__NODES);
}
return nodes;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EPackage getTypegraph() {
if (typegraph != null && typegraph.eIsProxy()) {
InternalEObject oldTypegraph = (InternalEObject)typegraph;
typegraph = (EPackage)eResolveProxy(oldTypegraph);
if (typegraph != oldTypegraph) {
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.RESOLVE, GraphPackage.GRAPH__TYPEGRAPH, oldTypegraph, typegraph));
}
}
return typegraph;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public EPackage basicGetTypegraph() {
return typegraph;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setTypegraph(EPackage newTypegraph) {
EPackage oldTypegraph = typegraph;
typegraph = newTypegraph;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GraphPackage.GRAPH__TYPEGRAPH, oldTypegraph, typegraph));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public String getName() {
return name;
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void setName(String newName) {
String oldName = name;
name = newName;
if (eNotificationRequired())
eNotify(new ENotificationImpl(this, Notification.SET, GraphPackage.GRAPH__NAME, oldName, name));
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
switch (featureID) {
case GraphPackage.GRAPH__EDGES:
return ((InternalEList<?>)getEdges()).basicRemove(otherEnd, msgs);
case GraphPackage.GRAPH__NODES:
return ((InternalEList<?>)getNodes()).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 GraphPackage.GRAPH__EDGES:
return getEdges();
case GraphPackage.GRAPH__NODES:
return getNodes();
case GraphPackage.GRAPH__TYPEGRAPH:
if (resolve) return getTypegraph();
return basicGetTypegraph();
case GraphPackage.GRAPH__NAME:
return getName();
}
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 GraphPackage.GRAPH__EDGES:
getEdges().clear();
getEdges().addAll((Collection<? extends Edge>)newValue);
return;
case GraphPackage.GRAPH__NODES:
getNodes().clear();
getNodes().addAll((Collection<? extends Node>)newValue);
return;
case GraphPackage.GRAPH__TYPEGRAPH:
setTypegraph((EPackage)newValue);
return;
case GraphPackage.GRAPH__NAME:
setName((String)newValue);
return;
}
super.eSet(featureID, newValue);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public void eUnset(int featureID) {
switch (featureID) {
case GraphPackage.GRAPH__EDGES:
getEdges().clear();
return;
case GraphPackage.GRAPH__NODES:
getNodes().clear();
return;
case GraphPackage.GRAPH__TYPEGRAPH:
setTypegraph((EPackage)null);
return;
case GraphPackage.GRAPH__NAME:
setName(NAME_EDEFAULT);
return;
}
super.eUnset(featureID);
}
/**
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
@Override
public boolean eIsSet(int featureID) {
switch (featureID) {
case GraphPackage.GRAPH__EDGES:
return edges != null && !edges.isEmpty();
case GraphPackage.GRAPH__NODES:
return nodes != null && !nodes.isEmpty();
case GraphPackage.GRAPH__TYPEGRAPH:
return typegraph != null;
case GraphPackage.GRAPH__NAME:
return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
}
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(" (name: ");
result.append(name);
result.append(')');
return result.toString();
}
} //GraphImpl