3 package org.opendaylight.nemo.tool.eclipse.plugin.editor.impl;
5 import java.util.Collection;
7 import org.eclipse.emf.common.notify.Notification;
9 import org.eclipse.emf.common.util.EList;
11 import org.eclipse.emf.ecore.EClass;
13 import org.eclipse.emf.ecore.impl.ENotificationImpl;
15 import org.eclipse.emf.ecore.util.EObjectResolvingEList;
17 import org.opendaylight.nemo.tool.eclipse.plugin.editor.Connection;
18 import org.opendaylight.nemo.tool.eclipse.plugin.editor.EditorPackage;
19 import org.opendaylight.nemo.tool.eclipse.plugin.editor.Node;
22 * <!-- begin-user-doc -->
23 * An implementation of the model object '<em><b>Connection</b></em>'.
24 * <!-- end-user-doc -->
26 * The following features are implemented:
29 * <li>{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.impl.ConnectionImpl#getName <em>Name</em>}</li>
30 * <li>{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.impl.ConnectionImpl#getEndnode <em>Endnode</em>}</li>
35 public class ConnectionImpl extends SentenceImpl implements Connection
38 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
39 * <!-- begin-user-doc -->
40 * <!-- end-user-doc -->
45 protected static final String NAME_EDEFAULT = null;
48 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
49 * <!-- begin-user-doc -->
50 * <!-- end-user-doc -->
55 protected String name = NAME_EDEFAULT;
58 * The cached value of the '{@link #getEndnode() <em>Endnode</em>}' reference list.
59 * <!-- begin-user-doc -->
60 * <!-- end-user-doc -->
65 protected EList<Node> endnode;
68 * <!-- begin-user-doc -->
69 * <!-- end-user-doc -->
72 protected ConnectionImpl()
78 * <!-- begin-user-doc -->
79 * <!-- end-user-doc -->
83 protected EClass eStaticClass()
85 return EditorPackage.Literals.CONNECTION;
89 * <!-- begin-user-doc -->
90 * <!-- end-user-doc -->
93 public String getName()
99 * <!-- begin-user-doc -->
100 * <!-- end-user-doc -->
103 public void setName(String newName)
105 String oldName = name;
107 if (eNotificationRequired())
108 eNotify(new ENotificationImpl(this, Notification.SET, EditorPackage.CONNECTION__NAME, oldName, name));
112 * <!-- begin-user-doc -->
113 * <!-- end-user-doc -->
116 public EList<Node> getEndnode()
120 endnode = new EObjectResolvingEList<Node>(Node.class, this, EditorPackage.CONNECTION__ENDNODE);
126 * <!-- begin-user-doc -->
127 * <!-- end-user-doc -->
131 public Object eGet(int featureID, boolean resolve, boolean coreType)
135 case EditorPackage.CONNECTION__NAME:
137 case EditorPackage.CONNECTION__ENDNODE:
140 return super.eGet(featureID, resolve, coreType);
144 * <!-- begin-user-doc -->
145 * <!-- end-user-doc -->
148 @SuppressWarnings("unchecked")
150 public void eSet(int featureID, Object newValue)
154 case EditorPackage.CONNECTION__NAME:
155 setName((String)newValue);
157 case EditorPackage.CONNECTION__ENDNODE:
158 getEndnode().clear();
159 getEndnode().addAll((Collection<? extends Node>)newValue);
162 super.eSet(featureID, newValue);
166 * <!-- begin-user-doc -->
167 * <!-- end-user-doc -->
171 public void eUnset(int featureID)
175 case EditorPackage.CONNECTION__NAME:
176 setName(NAME_EDEFAULT);
178 case EditorPackage.CONNECTION__ENDNODE:
179 getEndnode().clear();
182 super.eUnset(featureID);
186 * <!-- begin-user-doc -->
187 * <!-- end-user-doc -->
191 public boolean eIsSet(int featureID)
195 case EditorPackage.CONNECTION__NAME:
196 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
197 case EditorPackage.CONNECTION__ENDNODE:
198 return endnode != null && !endnode.isEmpty();
200 return super.eIsSet(featureID);
204 * <!-- begin-user-doc -->
205 * <!-- end-user-doc -->
209 public String toString()
211 if (eIsProxy()) return super.toString();
213 StringBuffer result = new StringBuffer(super.toString());
214 result.append(" (name: ");
217 return result.toString();