001 /**
002 * <copyright>
003 * </copyright>
004 *
005 * $Id$
006 */
007 package com.hammurapi.eventbus.snapshot.impl;
008
009 import com.hammurapi.eventbus.snapshot.CompositeEvent;
010 import com.hammurapi.eventbus.snapshot.Event;
011 import com.hammurapi.eventbus.snapshot.SnapshotPackage;
012
013 import java.util.Collection;
014 import org.eclipse.emf.common.notify.Notification;
015 import org.eclipse.emf.common.notify.NotificationChain;
016
017 import org.eclipse.emf.common.util.EList;
018 import org.eclipse.emf.ecore.EClass;
019 import org.eclipse.emf.ecore.InternalEObject;
020
021 import org.eclipse.emf.ecore.util.EObjectContainmentEList;
022 import org.eclipse.emf.ecore.util.InternalEList;
023 import org.eclipse.emf.ecore.impl.ENotificationImpl;
024
025 /**
026 * <!-- begin-user-doc -->
027 * An implementation of the model object '<em><b>Composite Event</b></em>'.
028 * <!-- end-user-doc -->
029 * <p>
030 * The following features are implemented:
031 * <ul>
032 * <li>{@link com.hammurapi.eventbus.snapshot.impl.CompositeEventImpl#getParts <em>Parts</em>}</li>
033 * </ul>
034 * </p>
035 *
036 * @generated
037 */
038 public class CompositeEventImpl extends EventImpl implements CompositeEvent {
039 /**
040 * The cached value of the '{@link #getParts() <em>Parts</em>}' containment reference list.
041 * <!-- begin-user-doc -->
042 * <!-- end-user-doc -->
043 * @see #getParts()
044 * @generated
045 * @ordered
046 */
047 protected EList<Event> parts;
048
049 /**
050 * <!-- begin-user-doc -->
051 * <!-- end-user-doc -->
052 * @generated
053 */
054 protected CompositeEventImpl() {
055 super();
056 }
057
058 /**
059 * <!-- begin-user-doc -->
060 * <!-- end-user-doc -->
061 * @generated
062 */
063 @Override
064 protected EClass eStaticClass() {
065 return SnapshotPackage.Literals.COMPOSITE_EVENT;
066 }
067
068 /**
069 * <!-- begin-user-doc -->
070 * <!-- end-user-doc -->
071 * @generated
072 */
073 public EList<Event> getParts() {
074 if (parts == null) {
075 parts = new EObjectContainmentEList<Event>(Event.class, this, SnapshotPackage.COMPOSITE_EVENT__PARTS);
076 }
077 return parts;
078 }
079
080 /**
081 * <!-- begin-user-doc -->
082 * <!-- end-user-doc -->
083 * @generated
084 */
085 @Override
086 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
087 switch (featureID) {
088 case SnapshotPackage.COMPOSITE_EVENT__PARTS:
089 return ((InternalEList<?>)getParts()).basicRemove(otherEnd, msgs);
090 }
091 return super.eInverseRemove(otherEnd, featureID, msgs);
092 }
093
094 /**
095 * <!-- begin-user-doc -->
096 * <!-- end-user-doc -->
097 * @generated
098 */
099 @Override
100 public Object eGet(int featureID, boolean resolve, boolean coreType) {
101 switch (featureID) {
102 case SnapshotPackage.COMPOSITE_EVENT__PARTS:
103 return getParts();
104 }
105 return super.eGet(featureID, resolve, coreType);
106 }
107
108 /**
109 * <!-- begin-user-doc -->
110 * <!-- end-user-doc -->
111 * @generated
112 */
113 @SuppressWarnings("unchecked")
114 @Override
115 public void eSet(int featureID, Object newValue) {
116 switch (featureID) {
117 case SnapshotPackage.COMPOSITE_EVENT__PARTS:
118 getParts().clear();
119 getParts().addAll((Collection<? extends Event>)newValue);
120 return;
121 }
122 super.eSet(featureID, newValue);
123 }
124
125 /**
126 * <!-- begin-user-doc -->
127 * <!-- end-user-doc -->
128 * @generated
129 */
130 @Override
131 public void eUnset(int featureID) {
132 switch (featureID) {
133 case SnapshotPackage.COMPOSITE_EVENT__PARTS:
134 getParts().clear();
135 return;
136 }
137 super.eUnset(featureID);
138 }
139
140 /**
141 * <!-- begin-user-doc -->
142 * <!-- end-user-doc -->
143 * @generated
144 */
145 @Override
146 public boolean eIsSet(int featureID) {
147 switch (featureID) {
148 case SnapshotPackage.COMPOSITE_EVENT__PARTS:
149 return parts != null && !parts.isEmpty();
150 }
151 return super.eIsSet(featureID);
152 }
153
154 } //CompositeEventImpl