| /******************************************************************************* |
| * CHESS core plugin |
| * |
| * Copyright (C) 2011-2015 |
| * Mälardalen University, Sweden |
| * |
| * |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License |
| * v1.0 which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| *******************************************************************************/ |
| package org.polarsys.chess.fla.flamm; |
| |
| import java.lang.reflect.InvocationTargetException; |
| |
| import java.util.Collection; |
| import java.util.List; |
| |
| 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.MinimalEObjectImpl; |
| |
| import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * A representation of the model object '<em><b>Connection</b></em>'. |
| * <!-- end-user-doc --> |
| * |
| * <p> |
| * The following features are supported: |
| * <ul> |
| * <li>{@link org.polarsys.chess.fla.flamm.Connection#getFrom <em>From</em>}</li> |
| * <li>{@link org.polarsys.chess.fla.flamm.Connection#getTo <em>To</em>}</li> |
| * <li>{@link org.polarsys.chess.fla.flamm.Connection#getRules <em>Rules</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @see org.polarsys.chess.fla.flamm.FlammPackage#getConnection() |
| * @model kind="class" |
| * @generated |
| */ |
| public class Connection extends MinimalEObjectImpl.Container implements FlaBehaviour { |
| /** |
| * The cached value of the '{@link #getFrom() <em>From</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getFrom() |
| * @generated |
| * @ordered |
| */ |
| protected Port from; |
| |
| /** |
| * The cached value of the '{@link #getTo() <em>To</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getTo() |
| * @generated |
| * @ordered |
| */ |
| protected Port to; |
| |
| /** |
| * The cached value of the '{@link #getRules() <em>Rules</em>}' reference list. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getRules() |
| * @generated |
| * @ordered |
| */ |
| protected EList<Rule> rules; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Connection() { |
| super(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return FlammPackage.Literals.CONNECTION; |
| } |
| |
| /** |
| * Returns the value of the '<em><b>From</b></em>' reference. |
| * It is bidirectional and its opposite is '{@link org.polarsys.chess.fla.flamm.Port#getOutgoingConnections <em>Outgoing Connections</em>}'. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>From</em>' reference isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>From</em>' reference. |
| * @see #setFrom(Port) |
| * @see org.polarsys.chess.fla.flamm.FlammPackage#getConnection_From() |
| * @see org.polarsys.chess.fla.flamm.Port#getOutgoingConnections |
| * @model opposite="outgoingConnections" required="true" |
| * @generated |
| */ |
| public Port getFrom() { |
| if (from != null && from.eIsProxy()) { |
| InternalEObject oldFrom = (InternalEObject)from; |
| from = (Port)eResolveProxy(oldFrom); |
| if (from != oldFrom) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FlammPackage.CONNECTION__FROM, oldFrom, from)); |
| } |
| } |
| return from; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Port basicGetFrom() { |
| return from; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetFrom(Port newFrom, NotificationChain msgs) { |
| Port oldFrom = from; |
| from = newFrom; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FlammPackage.CONNECTION__FROM, oldFrom, newFrom); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.polarsys.chess.fla.flamm.Connection#getFrom <em>From</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>From</em>' reference. |
| * @see #getFrom() |
| * @generated |
| */ |
| public void setFrom(Port newFrom) { |
| if (newFrom != from) { |
| NotificationChain msgs = null; |
| if (from != null) |
| msgs = ((InternalEObject)from).eInverseRemove(this, FlammPackage.PORT__OUTGOING_CONNECTIONS, Port.class, msgs); |
| if (newFrom != null) |
| msgs = ((InternalEObject)newFrom).eInverseAdd(this, FlammPackage.PORT__OUTGOING_CONNECTIONS, Port.class, msgs); |
| msgs = basicSetFrom(newFrom, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FlammPackage.CONNECTION__FROM, newFrom, newFrom)); |
| } |
| |
| /** |
| * Returns the value of the '<em><b>To</b></em>' reference. |
| * It is bidirectional and its opposite is '{@link org.polarsys.chess.fla.flamm.Port#getIncomingConnections <em>Incoming Connections</em>}'. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>To</em>' reference isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>To</em>' reference. |
| * @see #setTo(Port) |
| * @see org.polarsys.chess.fla.flamm.FlammPackage#getConnection_To() |
| * @see org.polarsys.chess.fla.flamm.Port#getIncomingConnections |
| * @model opposite="incomingConnections" required="true" |
| * @generated |
| */ |
| public Port getTo() { |
| if (to != null && to.eIsProxy()) { |
| InternalEObject oldTo = (InternalEObject)to; |
| to = (Port)eResolveProxy(oldTo); |
| if (to != oldTo) { |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.RESOLVE, FlammPackage.CONNECTION__TO, oldTo, to)); |
| } |
| } |
| return to; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public Port basicGetTo() { |
| return to; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public NotificationChain basicSetTo(Port newTo, NotificationChain msgs) { |
| Port oldTo = to; |
| to = newTo; |
| if (eNotificationRequired()) { |
| ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FlammPackage.CONNECTION__TO, oldTo, newTo); |
| if (msgs == null) msgs = notification; else msgs.add(notification); |
| } |
| return msgs; |
| } |
| |
| /** |
| * Sets the value of the '{@link org.polarsys.chess.fla.flamm.Connection#getTo <em>To</em>}' reference. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @param value the new value of the '<em>To</em>' reference. |
| * @see #getTo() |
| * @generated |
| */ |
| public void setTo(Port newTo) { |
| if (newTo != to) { |
| NotificationChain msgs = null; |
| if (to != null) |
| msgs = ((InternalEObject)to).eInverseRemove(this, FlammPackage.PORT__INCOMING_CONNECTIONS, Port.class, msgs); |
| if (newTo != null) |
| msgs = ((InternalEObject)newTo).eInverseAdd(this, FlammPackage.PORT__INCOMING_CONNECTIONS, Port.class, msgs); |
| msgs = basicSetTo(newTo, msgs); |
| if (msgs != null) msgs.dispatch(); |
| } |
| else if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, FlammPackage.CONNECTION__TO, newTo, newTo)); |
| } |
| |
| /** |
| * Returns the value of the '<em><b>Rules</b></em>' reference list. |
| * The list contents are of type {@link org.polarsys.chess.fla.flamm.Rule}. |
| * <!-- begin-user-doc --> |
| * <p> |
| * If the meaning of the '<em>Rules</em>' reference list isn't clear, |
| * there really should be more of a description here... |
| * </p> |
| * <!-- end-user-doc --> |
| * @return the value of the '<em>Rules</em>' reference list. |
| * @see org.polarsys.chess.fla.flamm.FlammPackage#getConnection_Rules() |
| * @model |
| * @generated |
| */ |
| public List<Rule> getRules() { |
| if (rules == null) { |
| rules = new EObjectResolvingEList<Rule>(Rule.class, this, FlammPackage.CONNECTION__RULES); |
| } |
| return rules; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @model |
| * @generated |
| */ |
| public void propagateFailures() { |
| // TODO: implement this method |
| // Ensure that you remove @generated or mark it @generated NOT |
| throw new UnsupportedOperationException(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @model initNoFailureRequired="true" |
| * @generated |
| */ |
| public void initialize(boolean initNoFailure) { |
| // TODO: implement this method |
| // Ensure that you remove @generated or mark it @generated NOT |
| throw new UnsupportedOperationException(); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FlammPackage.CONNECTION__FROM: |
| if (from != null) |
| msgs = ((InternalEObject)from).eInverseRemove(this, FlammPackage.PORT__OUTGOING_CONNECTIONS, Port.class, msgs); |
| return basicSetFrom((Port)otherEnd, msgs); |
| case FlammPackage.CONNECTION__TO: |
| if (to != null) |
| msgs = ((InternalEObject)to).eInverseRemove(this, FlammPackage.PORT__INCOMING_CONNECTIONS, Port.class, msgs); |
| return basicSetTo((Port)otherEnd, msgs); |
| } |
| return super.eInverseAdd(otherEnd, featureID, msgs); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { |
| switch (featureID) { |
| case FlammPackage.CONNECTION__FROM: |
| return basicSetFrom(null, msgs); |
| case FlammPackage.CONNECTION__TO: |
| return basicSetTo(null, 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 FlammPackage.CONNECTION__FROM: |
| if (resolve) return getFrom(); |
| return basicGetFrom(); |
| case FlammPackage.CONNECTION__TO: |
| if (resolve) return getTo(); |
| return basicGetTo(); |
| case FlammPackage.CONNECTION__RULES: |
| return getRules(); |
| } |
| 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 FlammPackage.CONNECTION__FROM: |
| setFrom((Port)newValue); |
| return; |
| case FlammPackage.CONNECTION__TO: |
| setTo((Port)newValue); |
| return; |
| case FlammPackage.CONNECTION__RULES: |
| getRules().clear(); |
| getRules().addAll((Collection<? extends Rule>)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case FlammPackage.CONNECTION__FROM: |
| setFrom((Port)null); |
| return; |
| case FlammPackage.CONNECTION__TO: |
| setTo((Port)null); |
| return; |
| case FlammPackage.CONNECTION__RULES: |
| getRules().clear(); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case FlammPackage.CONNECTION__FROM: |
| return from != null; |
| case FlammPackage.CONNECTION__TO: |
| return to != null; |
| case FlammPackage.CONNECTION__RULES: |
| return rules != null && !rules.isEmpty(); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eInvoke(int operationID, EList<?> arguments) throws InvocationTargetException { |
| switch (operationID) { |
| case FlammPackage.CONNECTION___PROPAGATE_FAILURES: |
| propagateFailures(); |
| return null; |
| case FlammPackage.CONNECTION___INITIALIZE__BOOLEAN: |
| initialize((Boolean)arguments.get(0)); |
| return null; |
| } |
| return super.eInvoke(operationID, arguments); |
| } |
| |
| } // Connection |