1 | /** |
2 | * <copyright> |
3 | * </copyright> |
4 | * |
5 | * $Id$ |
6 | */ |
7 | package com.hammurapi.eventbus.snapshot.impl; |
8 | |
9 | import com.hammurapi.eventbus.snapshot.Derivation; |
10 | import com.hammurapi.eventbus.snapshot.Event; |
11 | import com.hammurapi.eventbus.snapshot.Handler; |
12 | import com.hammurapi.eventbus.snapshot.SnapshotPackage; |
13 | |
14 | import java.util.Collection; |
15 | |
16 | import org.eclipse.emf.common.notify.Notification; |
17 | |
18 | import org.eclipse.emf.common.notify.NotificationChain; |
19 | import org.eclipse.emf.common.util.EList; |
20 | |
21 | import org.eclipse.emf.ecore.EClass; |
22 | import org.eclipse.emf.ecore.InternalEObject; |
23 | |
24 | import org.eclipse.emf.ecore.impl.ENotificationImpl; |
25 | import org.eclipse.emf.ecore.impl.EObjectImpl; |
26 | |
27 | import org.eclipse.emf.ecore.util.EObjectContainmentEList; |
28 | import org.eclipse.emf.ecore.util.InternalEList; |
29 | import org.eclipse.emf.ecore.util.EObjectResolvingEList; |
30 | |
31 | /** |
32 | * <!-- begin-user-doc --> |
33 | * An implementation of the model object '<em><b>Derivation</b></em>'. |
34 | * <!-- end-user-doc --> |
35 | * <p> |
36 | * The following features are implemented: |
37 | * <ul> |
38 | * <li>{@link com.hammurapi.eventbus.snapshot.impl.DerivationImpl#getHandler <em>Handler</em>}</li> |
39 | * <li>{@link com.hammurapi.eventbus.snapshot.impl.DerivationImpl#getInputs <em>Inputs</em>}</li> |
40 | * </ul> |
41 | * </p> |
42 | * |
43 | * @generated |
44 | */ |
45 | public class DerivationImpl extends EObjectImpl implements Derivation { |
46 | /** |
47 | * The cached value of the '{@link #getHandler() <em>Handler</em>}' reference. |
48 | * <!-- begin-user-doc --> |
49 | * <!-- end-user-doc --> |
50 | * @see #getHandler() |
51 | * @generated |
52 | * @ordered |
53 | */ |
54 | protected Handler handler; |
55 | |
56 | /** |
57 | * The cached value of the '{@link #getInputs() <em>Inputs</em>}' reference list. |
58 | * <!-- begin-user-doc --> |
59 | * <!-- end-user-doc --> |
60 | * @see #getInputs() |
61 | * @generated |
62 | * @ordered |
63 | */ |
64 | protected EList<Event> inputs; |
65 | |
66 | /** |
67 | * <!-- begin-user-doc --> |
68 | * <!-- end-user-doc --> |
69 | * @generated |
70 | */ |
71 | protected DerivationImpl() { |
72 | super(); |
73 | } |
74 | |
75 | /** |
76 | * <!-- begin-user-doc --> |
77 | * <!-- end-user-doc --> |
78 | * @generated |
79 | */ |
80 | @Override |
81 | protected EClass eStaticClass() { |
82 | return SnapshotPackage.Literals.DERIVATION; |
83 | } |
84 | |
85 | /** |
86 | * <!-- begin-user-doc --> |
87 | * <!-- end-user-doc --> |
88 | * @generated |
89 | */ |
90 | public Handler getHandler() { |
91 | if (handler != null && handler.eIsProxy()) { |
92 | InternalEObject oldHandler = (InternalEObject)handler; |
93 | handler = (Handler)eResolveProxy(oldHandler); |
94 | if (handler != oldHandler) { |
95 | if (eNotificationRequired()) |
96 | eNotify(new ENotificationImpl(this, Notification.RESOLVE, SnapshotPackage.DERIVATION__HANDLER, oldHandler, handler)); |
97 | } |
98 | } |
99 | return handler; |
100 | } |
101 | |
102 | /** |
103 | * <!-- begin-user-doc --> |
104 | * <!-- end-user-doc --> |
105 | * @generated |
106 | */ |
107 | public Handler basicGetHandler() { |
108 | return handler; |
109 | } |
110 | |
111 | /** |
112 | * <!-- begin-user-doc --> |
113 | * <!-- end-user-doc --> |
114 | * @generated |
115 | */ |
116 | public void setHandler(Handler newHandler) { |
117 | Handler oldHandler = handler; |
118 | handler = newHandler; |
119 | if (eNotificationRequired()) |
120 | eNotify(new ENotificationImpl(this, Notification.SET, SnapshotPackage.DERIVATION__HANDLER, oldHandler, handler)); |
121 | } |
122 | |
123 | /** |
124 | * <!-- begin-user-doc --> |
125 | * <!-- end-user-doc --> |
126 | * @generated |
127 | */ |
128 | public EList<Event> getInputs() { |
129 | if (inputs == null) { |
130 | inputs = new EObjectResolvingEList<Event>(Event.class, this, SnapshotPackage.DERIVATION__INPUTS); |
131 | } |
132 | return inputs; |
133 | } |
134 | |
135 | /** |
136 | * <!-- begin-user-doc --> |
137 | * <!-- end-user-doc --> |
138 | * @generated |
139 | */ |
140 | @Override |
141 | public Object eGet(int featureID, boolean resolve, boolean coreType) { |
142 | switch (featureID) { |
143 | case SnapshotPackage.DERIVATION__HANDLER: |
144 | if (resolve) return getHandler(); |
145 | return basicGetHandler(); |
146 | case SnapshotPackage.DERIVATION__INPUTS: |
147 | return getInputs(); |
148 | } |
149 | return super.eGet(featureID, resolve, coreType); |
150 | } |
151 | |
152 | /** |
153 | * <!-- begin-user-doc --> |
154 | * <!-- end-user-doc --> |
155 | * @generated |
156 | */ |
157 | @SuppressWarnings("unchecked") |
158 | @Override |
159 | public void eSet(int featureID, Object newValue) { |
160 | switch (featureID) { |
161 | case SnapshotPackage.DERIVATION__HANDLER: |
162 | setHandler((Handler)newValue); |
163 | return; |
164 | case SnapshotPackage.DERIVATION__INPUTS: |
165 | getInputs().clear(); |
166 | getInputs().addAll((Collection<? extends Event>)newValue); |
167 | return; |
168 | } |
169 | super.eSet(featureID, newValue); |
170 | } |
171 | |
172 | /** |
173 | * <!-- begin-user-doc --> |
174 | * <!-- end-user-doc --> |
175 | * @generated |
176 | */ |
177 | @Override |
178 | public void eUnset(int featureID) { |
179 | switch (featureID) { |
180 | case SnapshotPackage.DERIVATION__HANDLER: |
181 | setHandler((Handler)null); |
182 | return; |
183 | case SnapshotPackage.DERIVATION__INPUTS: |
184 | getInputs().clear(); |
185 | return; |
186 | } |
187 | super.eUnset(featureID); |
188 | } |
189 | |
190 | /** |
191 | * <!-- begin-user-doc --> |
192 | * <!-- end-user-doc --> |
193 | * @generated |
194 | */ |
195 | @Override |
196 | public boolean eIsSet(int featureID) { |
197 | switch (featureID) { |
198 | case SnapshotPackage.DERIVATION__HANDLER: |
199 | return handler != null; |
200 | case SnapshotPackage.DERIVATION__INPUTS: |
201 | return inputs != null && !inputs.isEmpty(); |
202 | } |
203 | return super.eIsSet(featureID); |
204 | } |
205 | |
206 | } //DerivationImpl |