001    /**
002     * <copyright>
003     * </copyright>
004     *
005     * $Id$
006     */
007    package com.hammurapi.eventbus.snapshot.impl;
008    
009    import com.hammurapi.eventbus.snapshot.JoinEntry;
010    import com.hammurapi.eventbus.snapshot.JoinInputCollector;
011    import com.hammurapi.eventbus.snapshot.SnapshotPackage;
012    
013    import java.util.Collection;
014    
015    import org.eclipse.emf.common.notify.NotificationChain;
016    
017    import org.eclipse.emf.common.util.EList;
018    
019    import org.eclipse.emf.ecore.EClass;
020    import org.eclipse.emf.ecore.InternalEObject;
021    
022    import org.eclipse.emf.ecore.impl.EObjectImpl;
023    
024    import org.eclipse.emf.ecore.util.EDataTypeUniqueEList;
025    import org.eclipse.emf.ecore.util.EObjectContainmentEList;
026    import org.eclipse.emf.ecore.util.InternalEList;
027    
028    /**
029     * <!-- begin-user-doc -->
030     * An implementation of the model object '<em><b>Join Input Collector</b></em>'.
031     * <!-- end-user-doc -->
032     * <p>
033     * The following features are implemented:
034     * <ul>
035     *   <li>{@link com.hammurapi.eventbus.snapshot.impl.JoinInputCollectorImpl#getIndices <em>Indices</em>}</li>
036     *   <li>{@link com.hammurapi.eventbus.snapshot.impl.JoinInputCollectorImpl#getJoinEntries <em>Join Entries</em>}</li>
037     * </ul>
038     * </p>
039     *
040     * @generated
041     */
042    public class JoinInputCollectorImpl extends EObjectImpl implements JoinInputCollector {
043            /**
044             * The cached value of the '{@link #getIndices() <em>Indices</em>}' attribute list.
045             * <!-- begin-user-doc -->
046             * <!-- end-user-doc -->
047             * @see #getIndices()
048             * @generated
049             * @ordered
050             */
051            protected EList<Integer> indices;
052    
053            /**
054             * The cached value of the '{@link #getJoinEntries() <em>Join Entries</em>}' containment reference list.
055             * <!-- begin-user-doc -->
056             * <!-- end-user-doc -->
057             * @see #getJoinEntries()
058             * @generated
059             * @ordered
060             */
061            protected EList<JoinEntry> joinEntries;
062    
063            /**
064             * <!-- begin-user-doc -->
065             * <!-- end-user-doc -->
066             * @generated
067             */
068            protected JoinInputCollectorImpl() {
069                    super();
070            }
071    
072            /**
073             * <!-- begin-user-doc -->
074             * <!-- end-user-doc -->
075             * @generated
076             */
077            @Override
078            protected EClass eStaticClass() {
079                    return SnapshotPackage.Literals.JOIN_INPUT_COLLECTOR;
080            }
081    
082            /**
083             * <!-- begin-user-doc -->
084             * <!-- end-user-doc -->
085             * @generated
086             */
087            public EList<Integer> getIndices() {
088                    if (indices == null) {
089                            indices = new EDataTypeUniqueEList<Integer>(Integer.class, this, SnapshotPackage.JOIN_INPUT_COLLECTOR__INDICES);
090                    }
091                    return indices;
092            }
093    
094            /**
095             * <!-- begin-user-doc -->
096             * <!-- end-user-doc -->
097             * @generated
098             */
099            public EList<JoinEntry> getJoinEntries() {
100                    if (joinEntries == null) {
101                            joinEntries = new EObjectContainmentEList<JoinEntry>(JoinEntry.class, this, SnapshotPackage.JOIN_INPUT_COLLECTOR__JOIN_ENTRIES);
102                    }
103                    return joinEntries;
104            }
105    
106            /**
107             * <!-- begin-user-doc -->
108             * <!-- end-user-doc -->
109             * @generated
110             */
111            @Override
112            public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
113                    switch (featureID) {
114                            case SnapshotPackage.JOIN_INPUT_COLLECTOR__JOIN_ENTRIES:
115                                    return ((InternalEList<?>)getJoinEntries()).basicRemove(otherEnd, msgs);
116                    }
117                    return super.eInverseRemove(otherEnd, featureID, msgs);
118            }
119    
120            /**
121             * <!-- begin-user-doc -->
122             * <!-- end-user-doc -->
123             * @generated
124             */
125            @Override
126            public Object eGet(int featureID, boolean resolve, boolean coreType) {
127                    switch (featureID) {
128                            case SnapshotPackage.JOIN_INPUT_COLLECTOR__INDICES:
129                                    return getIndices();
130                            case SnapshotPackage.JOIN_INPUT_COLLECTOR__JOIN_ENTRIES:
131                                    return getJoinEntries();
132                    }
133                    return super.eGet(featureID, resolve, coreType);
134            }
135    
136            /**
137             * <!-- begin-user-doc -->
138             * <!-- end-user-doc -->
139             * @generated
140             */
141            @SuppressWarnings("unchecked")
142            @Override
143            public void eSet(int featureID, Object newValue) {
144                    switch (featureID) {
145                            case SnapshotPackage.JOIN_INPUT_COLLECTOR__INDICES:
146                                    getIndices().clear();
147                                    getIndices().addAll((Collection<? extends Integer>)newValue);
148                                    return;
149                            case SnapshotPackage.JOIN_INPUT_COLLECTOR__JOIN_ENTRIES:
150                                    getJoinEntries().clear();
151                                    getJoinEntries().addAll((Collection<? extends JoinEntry>)newValue);
152                                    return;
153                    }
154                    super.eSet(featureID, newValue);
155            }
156    
157            /**
158             * <!-- begin-user-doc -->
159             * <!-- end-user-doc -->
160             * @generated
161             */
162            @Override
163            public void eUnset(int featureID) {
164                    switch (featureID) {
165                            case SnapshotPackage.JOIN_INPUT_COLLECTOR__INDICES:
166                                    getIndices().clear();
167                                    return;
168                            case SnapshotPackage.JOIN_INPUT_COLLECTOR__JOIN_ENTRIES:
169                                    getJoinEntries().clear();
170                                    return;
171                    }
172                    super.eUnset(featureID);
173            }
174    
175            /**
176             * <!-- begin-user-doc -->
177             * <!-- end-user-doc -->
178             * @generated
179             */
180            @Override
181            public boolean eIsSet(int featureID) {
182                    switch (featureID) {
183                            case SnapshotPackage.JOIN_INPUT_COLLECTOR__INDICES:
184                                    return indices != null && !indices.isEmpty();
185                            case SnapshotPackage.JOIN_INPUT_COLLECTOR__JOIN_ENTRIES:
186                                    return joinEntries != null && !joinEntries.isEmpty();
187                    }
188                    return super.eIsSet(featureID);
189            }
190    
191            /**
192             * <!-- begin-user-doc -->
193             * <!-- end-user-doc -->
194             * @generated
195             */
196            @Override
197            public String toString() {
198                    if (eIsProxy()) return super.toString();
199    
200                    StringBuffer result = new StringBuffer(super.toString());
201                    result.append(" (indices: ");
202                    result.append(indices);
203                    result.append(')');
204                    return result.toString();
205            }
206    
207    } //JoinInputCollectorImpl