001    /**
002     * <copyright>
003     * </copyright>
004     *
005     * $Id$
006     */
007    package com.hammurapi.flow.impl;
008    
009    import java.util.Collection;
010    
011    import org.eclipse.emf.common.notify.Notification;
012    import org.eclipse.emf.common.notify.NotificationChain;
013    import org.eclipse.emf.common.util.EList;
014    import org.eclipse.emf.ecore.EClass;
015    import org.eclipse.emf.ecore.InternalEObject;
016    import org.eclipse.emf.ecore.impl.ENotificationImpl;
017    import org.eclipse.emf.ecore.util.EObjectContainmentWithInverseEList;
018    import org.eclipse.emf.ecore.util.InternalEList;
019    
020    import com.hammurapi.flow.Flow;
021    import com.hammurapi.flow.FlowElement;
022    import com.hammurapi.flow.FlowPackage;
023    
024    /**
025     * <!-- begin-user-doc -->
026     * An implementation of the model object '<em><b>Flow</b></em>'.
027     * <!-- end-user-doc -->
028     * <p>
029     * The following features are implemented:
030     * <ul>
031     *   <li>{@link com.hammurapi.flow.impl.FlowImpl#getFlowElement <em>Flow Element</em>}</li>
032     *   <li>{@link com.hammurapi.flow.impl.FlowImpl#getFacadeInterface <em>Facade Interface</em>}</li>
033     * </ul>
034     * </p>
035     *
036     * @generated
037     */
038    public class FlowImpl extends NodeImpl implements Flow {
039            /**
040             * The cached value of the '{@link #getFlowElement() <em>Flow Element</em>}' containment reference list.
041             * <!-- begin-user-doc -->
042             * <!-- end-user-doc -->
043             * @see #getFlowElement()
044             * @generated
045             * @ordered
046             */
047            protected EList<FlowElement> flowElement;
048    
049            /**
050             * The default value of the '{@link #getFacadeInterface() <em>Facade Interface</em>}' attribute.
051             * <!-- begin-user-doc -->
052             * <!-- end-user-doc -->
053             * @see #getFacadeInterface()
054             * @generated
055             * @ordered
056             */
057            protected static final String FACADE_INTERFACE_EDEFAULT = null;
058    
059            /**
060             * The cached value of the '{@link #getFacadeInterface() <em>Facade Interface</em>}' attribute.
061             * <!-- begin-user-doc -->
062             * <!-- end-user-doc -->
063             * @see #getFacadeInterface()
064             * @generated
065             * @ordered
066             */
067            protected String facadeInterface = FACADE_INTERFACE_EDEFAULT;
068    
069            /**
070             * <!-- begin-user-doc -->
071             * <!-- end-user-doc -->
072             * @generated
073             */
074            protected FlowImpl() {
075                    super();
076            }
077    
078            /**
079             * <!-- begin-user-doc -->
080             * <!-- end-user-doc -->
081             * @generated
082             */
083            @Override
084            protected EClass eStaticClass() {
085                    return FlowPackage.Literals.FLOW;
086            }
087    
088            /**
089             * <!-- begin-user-doc -->
090             * <!-- end-user-doc -->
091             * @generated
092             */
093            public EList<FlowElement> getFlowElement() {
094                    if (flowElement == null) {
095                            flowElement = new EObjectContainmentWithInverseEList<FlowElement>(FlowElement.class, this, FlowPackage.FLOW__FLOW_ELEMENT, FlowPackage.FLOW_ELEMENT__FLOW);
096                    }
097                    return flowElement;
098            }
099    
100            /**
101             * <!-- begin-user-doc -->
102             * <!-- end-user-doc -->
103             * @generated
104             */
105            public String getFacadeInterface() {
106                    return facadeInterface;
107            }
108    
109            /**
110             * <!-- begin-user-doc -->
111             * <!-- end-user-doc -->
112             * @generated
113             */
114            public void setFacadeInterface(String newFacadeInterface) {
115                    String oldFacadeInterface = facadeInterface;
116                    facadeInterface = newFacadeInterface;
117                    if (eNotificationRequired())
118                            eNotify(new ENotificationImpl(this, Notification.SET, FlowPackage.FLOW__FACADE_INTERFACE, oldFacadeInterface, facadeInterface));
119            }
120    
121            /**
122             * <!-- begin-user-doc -->
123             * <!-- end-user-doc -->
124             * @generated
125             */
126            @SuppressWarnings("unchecked")
127            @Override
128            public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
129                    switch (featureID) {
130                            case FlowPackage.FLOW__FLOW_ELEMENT:
131                                    return ((InternalEList<InternalEObject>)(InternalEList<?>)getFlowElement()).basicAdd(otherEnd, msgs);
132                    }
133                    return super.eInverseAdd(otherEnd, featureID, msgs);
134            }
135    
136            /**
137             * <!-- begin-user-doc -->
138             * <!-- end-user-doc -->
139             * @generated
140             */
141            @Override
142            public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
143                    switch (featureID) {
144                            case FlowPackage.FLOW__FLOW_ELEMENT:
145                                    return ((InternalEList<?>)getFlowElement()).basicRemove(otherEnd, msgs);
146                    }
147                    return super.eInverseRemove(otherEnd, featureID, msgs);
148            }
149    
150            /**
151             * <!-- begin-user-doc -->
152             * <!-- end-user-doc -->
153             * @generated
154             */
155            @Override
156            public Object eGet(int featureID, boolean resolve, boolean coreType) {
157                    switch (featureID) {
158                            case FlowPackage.FLOW__FLOW_ELEMENT:
159                                    return getFlowElement();
160                            case FlowPackage.FLOW__FACADE_INTERFACE:
161                                    return getFacadeInterface();
162                    }
163                    return super.eGet(featureID, resolve, coreType);
164            }
165    
166            /**
167             * <!-- begin-user-doc -->
168             * <!-- end-user-doc -->
169             * @generated
170             */
171            @SuppressWarnings("unchecked")
172            @Override
173            public void eSet(int featureID, Object newValue) {
174                    switch (featureID) {
175                            case FlowPackage.FLOW__FLOW_ELEMENT:
176                                    getFlowElement().clear();
177                                    getFlowElement().addAll((Collection<? extends FlowElement>)newValue);
178                                    return;
179                            case FlowPackage.FLOW__FACADE_INTERFACE:
180                                    setFacadeInterface((String)newValue);
181                                    return;
182                    }
183                    super.eSet(featureID, newValue);
184            }
185    
186            /**
187             * <!-- begin-user-doc -->
188             * <!-- end-user-doc -->
189             * @generated
190             */
191            @Override
192            public void eUnset(int featureID) {
193                    switch (featureID) {
194                            case FlowPackage.FLOW__FLOW_ELEMENT:
195                                    getFlowElement().clear();
196                                    return;
197                            case FlowPackage.FLOW__FACADE_INTERFACE:
198                                    setFacadeInterface(FACADE_INTERFACE_EDEFAULT);
199                                    return;
200                    }
201                    super.eUnset(featureID);
202            }
203    
204            /**
205             * <!-- begin-user-doc -->
206             * <!-- end-user-doc -->
207             * @generated
208             */
209            @Override
210            public boolean eIsSet(int featureID) {
211                    switch (featureID) {
212                            case FlowPackage.FLOW__FLOW_ELEMENT:
213                                    return flowElement != null && !flowElement.isEmpty();
214                            case FlowPackage.FLOW__FACADE_INTERFACE:
215                                    return FACADE_INTERFACE_EDEFAULT == null ? facadeInterface != null : !FACADE_INTERFACE_EDEFAULT.equals(facadeInterface);
216                    }
217                    return super.eIsSet(featureID);
218            }
219    
220            /**
221             * <!-- begin-user-doc -->
222             * <!-- end-user-doc -->
223             * @generated
224             */
225            @Override
226            public String toString() {
227                    if (eIsProxy()) return super.toString();
228    
229                    StringBuffer result = new StringBuffer(super.toString());
230                    result.append(" (facadeInterface: ");
231                    result.append(facadeInterface);
232                    result.append(')');
233                    return result.toString();
234            }
235    
236    } //FlowImpl