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;
12 import org.eclipse.emf.ecore.InternalEObject;
14 import org.eclipse.emf.ecore.impl.ENotificationImpl;
16 import org.eclipse.emf.ecore.util.EDataTypeEList;
18 import org.opendaylight.nemo.tool.eclipse.plugin.editor.EditorPackage;
19 import org.opendaylight.nemo.tool.eclipse.plugin.editor.Flow;
20 import org.opendaylight.nemo.tool.eclipse.plugin.editor.Node;
21 import org.opendaylight.nemo.tool.eclipse.plugin.editor.Operation;
24 * <!-- begin-user-doc -->
25 * An implementation of the model object '<em><b>Operation</b></em>'.
26 * <!-- end-user-doc -->
28 * The following features are implemented:
31 * <li>{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.impl.OperationImpl#getName <em>Name</em>}</li>
32 * <li>{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.impl.OperationImpl#getValue <em>Value</em>}</li>
33 * <li>{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.impl.OperationImpl#getTargetId <em>Target Id</em>}</li>
34 * <li>{@link org.opendaylight.nemo.tool.eclipse.plugin.editor.impl.OperationImpl#getTargetNode <em>Target Node</em>}</li>
39 public class OperationImpl extends SentenceImpl implements Operation
42 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
43 * <!-- begin-user-doc -->
44 * <!-- end-user-doc -->
49 protected static final String NAME_EDEFAULT = null;
52 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
53 * <!-- begin-user-doc -->
54 * <!-- end-user-doc -->
59 protected String name = NAME_EDEFAULT;
62 * The cached value of the '{@link #getValue() <em>Value</em>}' attribute list.
63 * <!-- begin-user-doc -->
64 * <!-- end-user-doc -->
69 protected EList<Integer> value;
72 * The cached value of the '{@link #getTargetId() <em>Target Id</em>}' reference.
73 * <!-- begin-user-doc -->
74 * <!-- end-user-doc -->
79 protected Flow targetId;
82 * The cached value of the '{@link #getTargetNode() <em>Target Node</em>}' reference.
83 * <!-- begin-user-doc -->
84 * <!-- end-user-doc -->
85 * @see #getTargetNode()
89 protected Node targetNode;
92 * <!-- begin-user-doc -->
93 * <!-- end-user-doc -->
96 protected OperationImpl()
102 * <!-- begin-user-doc -->
103 * <!-- end-user-doc -->
107 protected EClass eStaticClass()
109 return EditorPackage.Literals.OPERATION;
113 * <!-- begin-user-doc -->
114 * <!-- end-user-doc -->
117 public String getName()
123 * <!-- begin-user-doc -->
124 * <!-- end-user-doc -->
127 public void setName(String newName)
129 String oldName = name;
131 if (eNotificationRequired())
132 eNotify(new ENotificationImpl(this, Notification.SET, EditorPackage.OPERATION__NAME, oldName, name));
136 * <!-- begin-user-doc -->
137 * <!-- end-user-doc -->
140 public EList<Integer> getValue()
144 value = new EDataTypeEList<Integer>(Integer.class, this, EditorPackage.OPERATION__VALUE);
150 * <!-- begin-user-doc -->
151 * <!-- end-user-doc -->
154 public Flow getTargetId()
156 if (targetId != null && targetId.eIsProxy())
158 InternalEObject oldTargetId = (InternalEObject)targetId;
159 targetId = (Flow)eResolveProxy(oldTargetId);
160 if (targetId != oldTargetId)
162 if (eNotificationRequired())
163 eNotify(new ENotificationImpl(this, Notification.RESOLVE, EditorPackage.OPERATION__TARGET_ID, oldTargetId, targetId));
170 * <!-- begin-user-doc -->
171 * <!-- end-user-doc -->
174 public Flow basicGetTargetId()
180 * <!-- begin-user-doc -->
181 * <!-- end-user-doc -->
184 public void setTargetId(Flow newTargetId)
186 Flow oldTargetId = targetId;
187 targetId = newTargetId;
188 if (eNotificationRequired())
189 eNotify(new ENotificationImpl(this, Notification.SET, EditorPackage.OPERATION__TARGET_ID, oldTargetId, targetId));
193 * <!-- begin-user-doc -->
194 * <!-- end-user-doc -->
197 public Node getTargetNode()
199 if (targetNode != null && targetNode.eIsProxy())
201 InternalEObject oldTargetNode = (InternalEObject)targetNode;
202 targetNode = (Node)eResolveProxy(oldTargetNode);
203 if (targetNode != oldTargetNode)
205 if (eNotificationRequired())
206 eNotify(new ENotificationImpl(this, Notification.RESOLVE, EditorPackage.OPERATION__TARGET_NODE, oldTargetNode, targetNode));
213 * <!-- begin-user-doc -->
214 * <!-- end-user-doc -->
217 public Node basicGetTargetNode()
223 * <!-- begin-user-doc -->
224 * <!-- end-user-doc -->
227 public void setTargetNode(Node newTargetNode)
229 Node oldTargetNode = targetNode;
230 targetNode = newTargetNode;
231 if (eNotificationRequired())
232 eNotify(new ENotificationImpl(this, Notification.SET, EditorPackage.OPERATION__TARGET_NODE, oldTargetNode, targetNode));
236 * <!-- begin-user-doc -->
237 * <!-- end-user-doc -->
241 public Object eGet(int featureID, boolean resolve, boolean coreType)
245 case EditorPackage.OPERATION__NAME:
247 case EditorPackage.OPERATION__VALUE:
249 case EditorPackage.OPERATION__TARGET_ID:
250 if (resolve) return getTargetId();
251 return basicGetTargetId();
252 case EditorPackage.OPERATION__TARGET_NODE:
253 if (resolve) return getTargetNode();
254 return basicGetTargetNode();
256 return super.eGet(featureID, resolve, coreType);
260 * <!-- begin-user-doc -->
261 * <!-- end-user-doc -->
264 @SuppressWarnings("unchecked")
266 public void eSet(int featureID, Object newValue)
270 case EditorPackage.OPERATION__NAME:
271 setName((String)newValue);
273 case EditorPackage.OPERATION__VALUE:
275 getValue().addAll((Collection<? extends Integer>)newValue);
277 case EditorPackage.OPERATION__TARGET_ID:
278 setTargetId((Flow)newValue);
280 case EditorPackage.OPERATION__TARGET_NODE:
281 setTargetNode((Node)newValue);
284 super.eSet(featureID, newValue);
288 * <!-- begin-user-doc -->
289 * <!-- end-user-doc -->
293 public void eUnset(int featureID)
297 case EditorPackage.OPERATION__NAME:
298 setName(NAME_EDEFAULT);
300 case EditorPackage.OPERATION__VALUE:
303 case EditorPackage.OPERATION__TARGET_ID:
304 setTargetId((Flow)null);
306 case EditorPackage.OPERATION__TARGET_NODE:
307 setTargetNode((Node)null);
310 super.eUnset(featureID);
314 * <!-- begin-user-doc -->
315 * <!-- end-user-doc -->
319 public boolean eIsSet(int featureID)
323 case EditorPackage.OPERATION__NAME:
324 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
325 case EditorPackage.OPERATION__VALUE:
326 return value != null && !value.isEmpty();
327 case EditorPackage.OPERATION__TARGET_ID:
328 return targetId != null;
329 case EditorPackage.OPERATION__TARGET_NODE:
330 return targetNode != null;
332 return super.eIsSet(featureID);
336 * <!-- begin-user-doc -->
337 * <!-- end-user-doc -->
341 public String toString()
343 if (eIsProxy()) return super.toString();
345 StringBuffer result = new StringBuffer(super.toString());
346 result.append(" (name: ");
348 result.append(", value: ");
349 result.append(value);
351 return result.toString();