001 /**
002 * <copyright>
003 * </copyright>
004 *
005 * $Id$
006 */
007 package com.hammurapi.party.impl;
008
009 import com.hammurapi.party.MatrixRelationship;
010 import com.hammurapi.party.Party;
011 import com.hammurapi.party.PartyPackage;
012 import com.hammurapi.party.Tag;
013
014 import java.util.Collection;
015 import java.util.Date;
016
017 import org.eclipse.emf.common.notify.Notification;
018 import org.eclipse.emf.common.notify.NotificationChain;
019
020 import org.eclipse.emf.common.util.EList;
021
022 import org.eclipse.emf.ecore.EClass;
023 import org.eclipse.emf.ecore.InternalEObject;
024
025 import org.eclipse.emf.ecore.impl.ENotificationImpl;
026 import org.eclipse.emf.ecore.impl.EObjectImpl;
027
028 import org.eclipse.emf.ecore.util.EObjectContainmentEList;
029 import org.eclipse.emf.ecore.util.InternalEList;
030
031 /**
032 * <!-- begin-user-doc -->
033 * An implementation of the model object '<em><b>Matrix Relationship</b></em>'.
034 * <!-- end-user-doc -->
035 * <p>
036 * The following features are implemented:
037 * <ul>
038 * <li>{@link com.hammurapi.party.impl.MatrixRelationshipImpl#getTags <em>Tags</em>}</li>
039 * <li>{@link com.hammurapi.party.impl.MatrixRelationshipImpl#getComment <em>Comment</em>}</li>
040 * <li>{@link com.hammurapi.party.impl.MatrixRelationshipImpl#getStart <em>Start</em>}</li>
041 * <li>{@link com.hammurapi.party.impl.MatrixRelationshipImpl#getEnd <em>End</em>}</li>
042 * <li>{@link com.hammurapi.party.impl.MatrixRelationshipImpl#getName <em>Name</em>}</li>
043 * <li>{@link com.hammurapi.party.impl.MatrixRelationshipImpl#getTarget <em>Target</em>}</li>
044 * </ul>
045 * </p>
046 *
047 * @generated
048 */
049 public class MatrixRelationshipImpl extends EObjectImpl implements MatrixRelationship {
050 /**
051 * The cached value of the '{@link #getTags() <em>Tags</em>}' containment reference list.
052 * <!-- begin-user-doc -->
053 * <!-- end-user-doc -->
054 * @see #getTags()
055 * @generated
056 * @ordered
057 */
058 protected EList<Tag> tags;
059
060 /**
061 * The default value of the '{@link #getComment() <em>Comment</em>}' attribute.
062 * <!-- begin-user-doc -->
063 * <!-- end-user-doc -->
064 * @see #getComment()
065 * @generated
066 * @ordered
067 */
068 protected static final String COMMENT_EDEFAULT = null;
069
070 /**
071 * The cached value of the '{@link #getComment() <em>Comment</em>}' attribute.
072 * <!-- begin-user-doc -->
073 * <!-- end-user-doc -->
074 * @see #getComment()
075 * @generated
076 * @ordered
077 */
078 protected String comment = COMMENT_EDEFAULT;
079
080 /**
081 * The default value of the '{@link #getStart() <em>Start</em>}' attribute.
082 * <!-- begin-user-doc -->
083 * <!-- end-user-doc -->
084 * @see #getStart()
085 * @generated
086 * @ordered
087 */
088 protected static final Date START_EDEFAULT = null;
089
090 /**
091 * The cached value of the '{@link #getStart() <em>Start</em>}' attribute.
092 * <!-- begin-user-doc -->
093 * <!-- end-user-doc -->
094 * @see #getStart()
095 * @generated
096 * @ordered
097 */
098 protected Date start = START_EDEFAULT;
099
100 /**
101 * The default value of the '{@link #getEnd() <em>End</em>}' attribute.
102 * <!-- begin-user-doc -->
103 * <!-- end-user-doc -->
104 * @see #getEnd()
105 * @generated
106 * @ordered
107 */
108 protected static final Date END_EDEFAULT = null;
109
110 /**
111 * The cached value of the '{@link #getEnd() <em>End</em>}' attribute.
112 * <!-- begin-user-doc -->
113 * <!-- end-user-doc -->
114 * @see #getEnd()
115 * @generated
116 * @ordered
117 */
118 protected Date end = END_EDEFAULT;
119
120 /**
121 * The default value of the '{@link #getName() <em>Name</em>}' attribute.
122 * <!-- begin-user-doc -->
123 * <!-- end-user-doc -->
124 * @see #getName()
125 * @generated
126 * @ordered
127 */
128 protected static final String NAME_EDEFAULT = null;
129
130 /**
131 * The cached value of the '{@link #getName() <em>Name</em>}' attribute.
132 * <!-- begin-user-doc -->
133 * <!-- end-user-doc -->
134 * @see #getName()
135 * @generated
136 * @ordered
137 */
138 protected String name = NAME_EDEFAULT;
139
140 /**
141 * The cached value of the '{@link #getTarget() <em>Target</em>}' reference.
142 * <!-- begin-user-doc -->
143 * <!-- end-user-doc -->
144 * @see #getTarget()
145 * @generated
146 * @ordered
147 */
148 protected Party target;
149
150 /**
151 * <!-- begin-user-doc -->
152 * <!-- end-user-doc -->
153 * @generated
154 */
155 protected MatrixRelationshipImpl() {
156 super();
157 }
158
159 /**
160 * <!-- begin-user-doc -->
161 * <!-- end-user-doc -->
162 * @generated
163 */
164 @Override
165 protected EClass eStaticClass() {
166 return PartyPackage.Literals.MATRIX_RELATIONSHIP;
167 }
168
169 /**
170 * <!-- begin-user-doc -->
171 * <!-- end-user-doc -->
172 * @generated
173 */
174 public EList<Tag> getTags() {
175 if (tags == null) {
176 tags = new EObjectContainmentEList<Tag>(Tag.class, this, PartyPackage.MATRIX_RELATIONSHIP__TAGS);
177 }
178 return tags;
179 }
180
181 /**
182 * <!-- begin-user-doc -->
183 * <!-- end-user-doc -->
184 * @generated
185 */
186 public String getComment() {
187 return comment;
188 }
189
190 /**
191 * <!-- begin-user-doc -->
192 * <!-- end-user-doc -->
193 * @generated
194 */
195 public void setComment(String newComment) {
196 String oldComment = comment;
197 comment = newComment;
198 if (eNotificationRequired())
199 eNotify(new ENotificationImpl(this, Notification.SET, PartyPackage.MATRIX_RELATIONSHIP__COMMENT, oldComment, comment));
200 }
201
202 /**
203 * <!-- begin-user-doc -->
204 * <!-- end-user-doc -->
205 * @generated
206 */
207 public Date getStart() {
208 return start;
209 }
210
211 /**
212 * <!-- begin-user-doc -->
213 * <!-- end-user-doc -->
214 * @generated
215 */
216 public void setStart(Date newStart) {
217 Date oldStart = start;
218 start = newStart;
219 if (eNotificationRequired())
220 eNotify(new ENotificationImpl(this, Notification.SET, PartyPackage.MATRIX_RELATIONSHIP__START, oldStart, start));
221 }
222
223 /**
224 * <!-- begin-user-doc -->
225 * <!-- end-user-doc -->
226 * @generated
227 */
228 public Date getEnd() {
229 return end;
230 }
231
232 /**
233 * <!-- begin-user-doc -->
234 * <!-- end-user-doc -->
235 * @generated
236 */
237 public void setEnd(Date newEnd) {
238 Date oldEnd = end;
239 end = newEnd;
240 if (eNotificationRequired())
241 eNotify(new ENotificationImpl(this, Notification.SET, PartyPackage.MATRIX_RELATIONSHIP__END, oldEnd, end));
242 }
243
244 /**
245 * <!-- begin-user-doc -->
246 * <!-- end-user-doc -->
247 * @generated
248 */
249 public String getName() {
250 return name;
251 }
252
253 /**
254 * <!-- begin-user-doc -->
255 * <!-- end-user-doc -->
256 * @generated
257 */
258 public void setName(String newName) {
259 String oldName = name;
260 name = newName;
261 if (eNotificationRequired())
262 eNotify(new ENotificationImpl(this, Notification.SET, PartyPackage.MATRIX_RELATIONSHIP__NAME, oldName, name));
263 }
264
265 /**
266 * <!-- begin-user-doc -->
267 * <!-- end-user-doc -->
268 * @generated
269 */
270 public Party getTarget() {
271 if (target != null && target.eIsProxy()) {
272 InternalEObject oldTarget = (InternalEObject)target;
273 target = (Party)eResolveProxy(oldTarget);
274 if (target != oldTarget) {
275 if (eNotificationRequired())
276 eNotify(new ENotificationImpl(this, Notification.RESOLVE, PartyPackage.MATRIX_RELATIONSHIP__TARGET, oldTarget, target));
277 }
278 }
279 return target;
280 }
281
282 /**
283 * <!-- begin-user-doc -->
284 * <!-- end-user-doc -->
285 * @generated
286 */
287 public Party basicGetTarget() {
288 return target;
289 }
290
291 /**
292 * <!-- begin-user-doc -->
293 * <!-- end-user-doc -->
294 * @generated
295 */
296 public void setTarget(Party newTarget) {
297 Party oldTarget = target;
298 target = newTarget;
299 if (eNotificationRequired())
300 eNotify(new ENotificationImpl(this, Notification.SET, PartyPackage.MATRIX_RELATIONSHIP__TARGET, oldTarget, target));
301 }
302
303 /**
304 * <!-- begin-user-doc -->
305 * <!-- end-user-doc -->
306 * @generated
307 */
308 public boolean isEffectiveNow() {
309 // TODO: implement this method
310 // Ensure that you remove @generated or mark it @generated NOT
311 throw new UnsupportedOperationException();
312 }
313
314 /**
315 * <!-- begin-user-doc -->
316 * <!-- end-user-doc -->
317 * @generated
318 */
319 public boolean isEffective(Date date) {
320 // TODO: implement this method
321 // Ensure that you remove @generated or mark it @generated NOT
322 throw new UnsupportedOperationException();
323 }
324
325 /**
326 * <!-- begin-user-doc -->
327 * <!-- end-user-doc -->
328 * @generated
329 */
330 @Override
331 public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
332 switch (featureID) {
333 case PartyPackage.MATRIX_RELATIONSHIP__TAGS:
334 return ((InternalEList<?>)getTags()).basicRemove(otherEnd, msgs);
335 }
336 return super.eInverseRemove(otherEnd, featureID, msgs);
337 }
338
339 /**
340 * <!-- begin-user-doc -->
341 * <!-- end-user-doc -->
342 * @generated
343 */
344 @Override
345 public Object eGet(int featureID, boolean resolve, boolean coreType) {
346 switch (featureID) {
347 case PartyPackage.MATRIX_RELATIONSHIP__TAGS:
348 return getTags();
349 case PartyPackage.MATRIX_RELATIONSHIP__COMMENT:
350 return getComment();
351 case PartyPackage.MATRIX_RELATIONSHIP__START:
352 return getStart();
353 case PartyPackage.MATRIX_RELATIONSHIP__END:
354 return getEnd();
355 case PartyPackage.MATRIX_RELATIONSHIP__NAME:
356 return getName();
357 case PartyPackage.MATRIX_RELATIONSHIP__TARGET:
358 if (resolve) return getTarget();
359 return basicGetTarget();
360 }
361 return super.eGet(featureID, resolve, coreType);
362 }
363
364 /**
365 * <!-- begin-user-doc -->
366 * <!-- end-user-doc -->
367 * @generated
368 */
369 @SuppressWarnings("unchecked")
370 @Override
371 public void eSet(int featureID, Object newValue) {
372 switch (featureID) {
373 case PartyPackage.MATRIX_RELATIONSHIP__TAGS:
374 getTags().clear();
375 getTags().addAll((Collection<? extends Tag>)newValue);
376 return;
377 case PartyPackage.MATRIX_RELATIONSHIP__COMMENT:
378 setComment((String)newValue);
379 return;
380 case PartyPackage.MATRIX_RELATIONSHIP__START:
381 setStart((Date)newValue);
382 return;
383 case PartyPackage.MATRIX_RELATIONSHIP__END:
384 setEnd((Date)newValue);
385 return;
386 case PartyPackage.MATRIX_RELATIONSHIP__NAME:
387 setName((String)newValue);
388 return;
389 case PartyPackage.MATRIX_RELATIONSHIP__TARGET:
390 setTarget((Party)newValue);
391 return;
392 }
393 super.eSet(featureID, newValue);
394 }
395
396 /**
397 * <!-- begin-user-doc -->
398 * <!-- end-user-doc -->
399 * @generated
400 */
401 @Override
402 public void eUnset(int featureID) {
403 switch (featureID) {
404 case PartyPackage.MATRIX_RELATIONSHIP__TAGS:
405 getTags().clear();
406 return;
407 case PartyPackage.MATRIX_RELATIONSHIP__COMMENT:
408 setComment(COMMENT_EDEFAULT);
409 return;
410 case PartyPackage.MATRIX_RELATIONSHIP__START:
411 setStart(START_EDEFAULT);
412 return;
413 case PartyPackage.MATRIX_RELATIONSHIP__END:
414 setEnd(END_EDEFAULT);
415 return;
416 case PartyPackage.MATRIX_RELATIONSHIP__NAME:
417 setName(NAME_EDEFAULT);
418 return;
419 case PartyPackage.MATRIX_RELATIONSHIP__TARGET:
420 setTarget((Party)null);
421 return;
422 }
423 super.eUnset(featureID);
424 }
425
426 /**
427 * <!-- begin-user-doc -->
428 * <!-- end-user-doc -->
429 * @generated
430 */
431 @Override
432 public boolean eIsSet(int featureID) {
433 switch (featureID) {
434 case PartyPackage.MATRIX_RELATIONSHIP__TAGS:
435 return tags != null && !tags.isEmpty();
436 case PartyPackage.MATRIX_RELATIONSHIP__COMMENT:
437 return COMMENT_EDEFAULT == null ? comment != null : !COMMENT_EDEFAULT.equals(comment);
438 case PartyPackage.MATRIX_RELATIONSHIP__START:
439 return START_EDEFAULT == null ? start != null : !START_EDEFAULT.equals(start);
440 case PartyPackage.MATRIX_RELATIONSHIP__END:
441 return END_EDEFAULT == null ? end != null : !END_EDEFAULT.equals(end);
442 case PartyPackage.MATRIX_RELATIONSHIP__NAME:
443 return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name);
444 case PartyPackage.MATRIX_RELATIONSHIP__TARGET:
445 return target != null;
446 }
447 return super.eIsSet(featureID);
448 }
449
450 /**
451 * <!-- begin-user-doc -->
452 * <!-- end-user-doc -->
453 * @generated
454 */
455 @Override
456 public String toString() {
457 if (eIsProxy()) return super.toString();
458
459 StringBuffer result = new StringBuffer(super.toString());
460 result.append(" (comment: ");
461 result.append(comment);
462 result.append(", start: ");
463 result.append(start);
464 result.append(", end: ");
465 result.append(end);
466 result.append(", name: ");
467 result.append(name);
468 result.append(')');
469 return result.toString();
470 }
471
472 } //MatrixRelationshipImpl