|
Lines 34-39
Link Here
|
| 34 |
import org.eclipse.emf.common.notify.Adapter; |
34 |
import org.eclipse.emf.common.notify.Adapter; |
| 35 |
import org.eclipse.emf.common.notify.Notification; |
35 |
import org.eclipse.emf.common.notify.Notification; |
| 36 |
import org.eclipse.emf.common.notify.NotificationChain; |
36 |
import org.eclipse.emf.common.notify.NotificationChain; |
|
|
37 |
import org.eclipse.emf.common.util.BasicEList; |
| 37 |
import org.eclipse.emf.common.util.BasicEMap; |
38 |
import org.eclipse.emf.common.util.BasicEMap; |
| 38 |
import org.eclipse.emf.common.util.ECollections; |
39 |
import org.eclipse.emf.common.util.ECollections; |
| 39 |
import org.eclipse.emf.common.util.EList; |
40 |
import org.eclipse.emf.common.util.EList; |
|
Lines 49-55
Link Here
|
| 49 |
import org.eclipse.emf.ecore.impl.EStoreEObjectImpl; |
50 |
import org.eclipse.emf.ecore.impl.EStoreEObjectImpl; |
| 50 |
import org.eclipse.emf.ecore.resource.Resource; |
51 |
import org.eclipse.emf.ecore.resource.Resource; |
| 51 |
import org.eclipse.emf.ecore.resource.Resource.Internal; |
52 |
import org.eclipse.emf.ecore.resource.Resource.Internal; |
| 52 |
import org.eclipse.emf.ecore.util.DelegatingEcoreEList; |
|
|
| 53 |
import org.eclipse.emf.ecore.util.DelegatingFeatureMap; |
53 |
import org.eclipse.emf.ecore.util.DelegatingFeatureMap; |
| 54 |
import org.eclipse.emf.ecore.util.EcoreEList; |
54 |
import org.eclipse.emf.ecore.util.EcoreEList; |
| 55 |
import org.eclipse.emf.ecore.util.EcoreEMap; |
55 |
import org.eclipse.emf.ecore.util.EcoreEMap; |
|
Lines 77-86
Link Here
|
| 77 |
|
77 |
|
| 78 |
private InternalCDORevision revision; |
78 |
private InternalCDORevision revision; |
| 79 |
|
79 |
|
|
|
80 |
/** |
| 81 |
* CDO used this list instead of eSettings for transient objects. EMF used eSettings as cache. CDO deactivate the |
| 82 |
* cache but EMF still use eSettings to store list wrapper. CDO needs another place to store the real list with the |
| 83 |
* actual data (transient mode) and accessible through EStore. This allow CDO to always use the same instance of the |
| 84 |
* list wrapper. |
| 85 |
*/ |
| 86 |
private transient Object eTransientSettings[]; |
| 87 |
|
| 80 |
public CDOObjectImpl() |
88 |
public CDOObjectImpl() |
| 81 |
{ |
89 |
{ |
| 82 |
state = CDOState.TRANSIENT; |
90 |
state = CDOState.TRANSIENT; |
| 83 |
eContainer = null; |
91 |
eContainer = null; |
|
|
92 |
eTransientSettings = null; |
| 84 |
} |
93 |
} |
| 85 |
|
94 |
|
| 86 |
public CDOID cdoID() |
95 |
public CDOID cdoID() |
|
Lines 98-103
Link Here
|
| 98 |
return revision; |
107 |
return revision; |
| 99 |
} |
108 |
} |
| 100 |
|
109 |
|
|
|
110 |
/** |
| 111 |
* @since 2.0 |
| 112 |
*/ |
| 113 |
protected Object[] eTransientSettings() |
| 114 |
{ |
| 115 |
if (eTransientSettings == null) |
| 116 |
{ |
| 117 |
int size = eClass().getFeatureCount() - eStaticFeatureCount(); |
| 118 |
eTransientSettings = size == 0 ? ENO_SETTINGS : new Object[size]; |
| 119 |
} |
| 120 |
return eTransientSettings; |
| 121 |
} |
| 122 |
|
| 123 |
/** |
| 124 |
* @since 2.0 |
| 125 |
*/ |
| 126 |
protected Object[] eBasicTransientSettings() |
| 127 |
{ |
| 128 |
return eTransientSettings; |
| 129 |
} |
| 130 |
|
| 101 |
public CDOClass cdoClass() |
131 |
public CDOClass cdoClass() |
| 102 |
{ |
132 |
{ |
| 103 |
return getCDOClass(this); |
133 |
return getCDOClass(this); |
|
Lines 201-206
Link Here
|
| 201 |
|
231 |
|
| 202 |
public void cdoInternalPostLoad() |
232 |
public void cdoInternalPostLoad() |
| 203 |
{ |
233 |
{ |
|
|
234 |
// Reset EMAP objects |
| 204 |
if (eSettings != null) |
235 |
if (eSettings != null) |
| 205 |
{ |
236 |
{ |
| 206 |
// Make sure transient feature are kept but persisted value are not cached. |
237 |
// Make sure transient feature are kept but persisted value are not cached. |
|
Lines 230-249
Link Here
|
| 230 |
*/ |
261 |
*/ |
| 231 |
public void cdoInternalCleanup() |
262 |
public void cdoInternalCleanup() |
| 232 |
{ |
263 |
{ |
| 233 |
if (eSettings != null) |
264 |
|
| 234 |
{ |
|
|
| 235 |
// Make sure transient feature are kept but persisted value are not cached. |
| 236 |
EClass eClass = eClass(); |
| 237 |
for (int i = 0; i < eClass.getFeatureCount(); i++) |
| 238 |
{ |
| 239 |
EStructuralFeature eFeature = cdoInternalDynamicFeature(i); |
| 240 |
// We need to keep the existing list if possible. |
| 241 |
if (!eFeature.isTransient()) |
| 242 |
{ |
| 243 |
eSettings[i] = null; |
| 244 |
} |
| 245 |
} |
| 246 |
} |
| 247 |
} |
265 |
} |
| 248 |
|
266 |
|
| 249 |
public void cdoInternalPostAttach() |
267 |
public void cdoInternalPostAttach() |
|
Lines 263-270
Link Here
|
| 263 |
revision.setResourceID(cdoResource.cdoID()); |
281 |
revision.setResourceID(cdoResource.cdoID()); |
| 264 |
} |
282 |
} |
| 265 |
|
283 |
|
| 266 |
eSettings(); |
|
|
| 267 |
|
| 268 |
EClass eClass = eClass(); |
284 |
EClass eClass = eClass(); |
| 269 |
for (int i = 0; i < eClass.getFeatureCount(); i++) |
285 |
for (int i = 0; i < eClass.getFeatureCount(); i++) |
| 270 |
{ |
286 |
{ |
|
Lines 274-279
Link Here
|
| 274 |
populateRevisionFeature(view, revision, eFeature, eSettings, i); |
290 |
populateRevisionFeature(view, revision, eFeature, eSettings, i); |
| 275 |
} |
291 |
} |
| 276 |
} |
292 |
} |
|
|
293 |
eTransientSettings = null; |
| 277 |
} |
294 |
} |
| 278 |
|
295 |
|
| 279 |
@SuppressWarnings("unchecked") |
296 |
@SuppressWarnings("unchecked") |
|
Lines 287-298
Link Here
|
| 287 |
TRACER.format("Populating feature {0}", cdoFeature); |
304 |
TRACER.format("Populating feature {0}", cdoFeature); |
| 288 |
} |
305 |
} |
| 289 |
|
306 |
|
| 290 |
Object setting = eSettings[i]; |
307 |
Object setting = eBasicTransientSettings() != null ? eTransientSettings()[i] : null; |
| 291 |
if (setting == null) |
308 |
if (setting == null) |
| 292 |
{ |
309 |
{ |
| 293 |
setting = eFeature.getDefaultValue(); |
310 |
setting = eFeature.getDefaultValue(); |
| 294 |
} |
311 |
} |
| 295 |
|
|
|
| 296 |
if (cdoFeature.isMany()) |
312 |
if (cdoFeature.isMany()) |
| 297 |
{ |
313 |
{ |
| 298 |
if (setting != null) |
314 |
if (setting != null) |
|
Lines 330-342
Link Here
|
| 330 |
|
346 |
|
| 331 |
revision.set(cdoFeature, 0, setting); |
347 |
revision.set(cdoFeature, 0, setting); |
| 332 |
} |
348 |
} |
| 333 |
|
|
|
| 334 |
if (eSettings != null) |
| 335 |
{ |
| 336 |
eSettings[i] = null; |
| 337 |
} |
| 338 |
} |
349 |
} |
| 339 |
|
350 |
|
|
|
351 |
/** |
| 352 |
* It is really important to access the data to go through getStore. eStore will redirect you to the transient data. |
| 353 |
*/ |
| 340 |
public void cdoInternalPostDetach() |
354 |
public void cdoInternalPostDetach() |
| 341 |
{ |
355 |
{ |
| 342 |
if (TRACER.isEnabled()) |
356 |
if (TRACER.isEnabled()) |
|
Lines 346-352
Link Here
|
| 346 |
|
360 |
|
| 347 |
CDOViewImpl view = cdoView(); |
361 |
CDOViewImpl view = cdoView(); |
| 348 |
super.eSetDirectResource(cdoDirectResource()); |
362 |
super.eSetDirectResource(cdoDirectResource()); |
| 349 |
eContainer = eStore().getContainer(this); |
363 |
eContainer = getStore().getContainer(this); |
| 350 |
eContainerFeatureID = getStore().getContainingFeatureID(this); |
364 |
eContainerFeatureID = getStore().getContainingFeatureID(this); |
| 351 |
if (eContainer != null && eContainmentFeature().isResolveProxies()) |
365 |
if (eContainer != null && eContainmentFeature().isResolveProxies()) |
| 352 |
{ |
366 |
{ |
|
Lines 354-360
Link Here
|
| 354 |
} |
368 |
} |
| 355 |
|
369 |
|
| 356 |
// Ensure that the internal eSettings array is initialized; |
370 |
// Ensure that the internal eSettings array is initialized; |
| 357 |
eSettings(); |
371 |
eTransientSettings = null; |
|
|
372 |
eTransientSettings(); |
| 358 |
|
373 |
|
| 359 |
EClass eClass = eClass(); |
374 |
EClass eClass = eClass(); |
| 360 |
for (int i = 0; i < eClass.getFeatureCount(); i++) |
375 |
for (int i = 0; i < eClass.getFeatureCount(); i++) |
|
Lines 367-373
Link Here
|
| 367 |
} |
382 |
} |
| 368 |
} |
383 |
} |
| 369 |
|
384 |
|
| 370 |
@SuppressWarnings("unchecked") |
|
|
| 371 |
private void depopulateRevisionFeature(CDOViewImpl view, InternalCDORevision revision, EStructuralFeature eFeature, |
385 |
private void depopulateRevisionFeature(CDOViewImpl view, InternalCDORevision revision, EStructuralFeature eFeature, |
| 372 |
Object[] eSettings, int i) |
386 |
Object[] eSettings, int i) |
| 373 |
{ |
387 |
{ |
|
Lines 379-395
Link Here
|
| 379 |
EStructuralFeature.Internal internalFeature = (EStructuralFeature.Internal)eFeature; |
393 |
EStructuralFeature.Internal internalFeature = (EStructuralFeature.Internal)eFeature; |
| 380 |
EReference oppositeReference = cdoID().isTemporary() ? null : internalFeature.getEOpposite(); |
394 |
EReference oppositeReference = cdoID().isTemporary() ? null : internalFeature.getEOpposite(); |
| 381 |
|
395 |
|
|
|
396 |
CDOStore cdoStore = getStore(); |
| 397 |
EStore transientStore = eStore(); |
| 382 |
if (eFeature.isMany()) |
398 |
if (eFeature.isMany()) |
| 383 |
{ |
399 |
{ |
| 384 |
eSettings[i] = null; |
400 |
|
| 385 |
InternalEList<Object> setting = (InternalEList<Object>)eGet(eFeature, true); |
401 |
int size = cdoStore.size(this, eFeature); |
| 386 |
int size = eStore().size(this, eFeature); |
|
|
| 387 |
for (int index = 0; index < size; index++) |
402 |
for (int index = 0; index < size; index++) |
| 388 |
{ |
403 |
{ |
| 389 |
// Do not trigger events |
404 |
// Do not trigger events |
| 390 |
// Do not trigger inverse updates |
405 |
// Do not trigger inverse updates |
| 391 |
Object object = eStore().get(this, eFeature, index); |
406 |
Object object = cdoStore.get(this, eFeature, index); |
| 392 |
setting.basicAdd(object, null); |
407 |
transientStore.add(this, eFeature, index, object); |
| 393 |
if (oppositeReference != null) |
408 |
if (oppositeReference != null) |
| 394 |
{ |
409 |
{ |
| 395 |
adjustOppositeReference((InternalEObject)object, oppositeReference); |
410 |
adjustOppositeReference((InternalEObject)object, oppositeReference); |
|
Lines 398-407
Link Here
|
| 398 |
} |
413 |
} |
| 399 |
else |
414 |
else |
| 400 |
{ |
415 |
{ |
| 401 |
eSettings[i] = eStore().get(this, eFeature, 0); |
416 |
Object object = cdoStore.get(this, eFeature, EStore.NO_INDEX); |
|
|
417 |
transientStore.set(this, eFeature, EStore.NO_INDEX, object); |
| 402 |
if (oppositeReference != null) |
418 |
if (oppositeReference != null) |
| 403 |
{ |
419 |
{ |
| 404 |
adjustOppositeReference((InternalEObject)eSettings[i], oppositeReference); |
420 |
adjustOppositeReference((InternalEObject)object, oppositeReference); |
| 405 |
} |
421 |
} |
| 406 |
} |
422 |
} |
| 407 |
} |
423 |
} |
|
Lines 534-540
Link Here
|
| 534 |
public EStoreEcoreEMap() |
550 |
public EStoreEcoreEMap() |
| 535 |
{ |
551 |
{ |
| 536 |
super((EClass)eType, eType.getInstanceClass(), null); |
552 |
super((EClass)eType, eType.getInstanceClass(), null); |
| 537 |
delegateEList = new CDOStoreEList<BasicEMap.Entry<Object, Object>>(eStructuralFeature) |
553 |
delegateEList = new BasicEStoreEList<BasicEMap.Entry<Object, Object>>(CDOObjectImpl.this, eStructuralFeature) |
| 538 |
{ |
554 |
{ |
| 539 |
private static final long serialVersionUID = 1L; |
555 |
private static final long serialVersionUID = 1L; |
| 540 |
|
556 |
|
|
Lines 576-582
Link Here
|
| 576 |
|
592 |
|
| 577 |
private void checkListForReading() |
593 |
private void checkListForReading() |
| 578 |
{ |
594 |
{ |
| 579 |
CDOStateMachine.INSTANCE.read(CDOObjectImpl.this); |
595 |
if (!FSMUtil.isTransient(CDOObjectImpl.this)) |
|
|
596 |
{ |
| 597 |
CDOStateMachine.INSTANCE.read(CDOObjectImpl.this); |
| 598 |
} |
| 580 |
} |
599 |
} |
| 581 |
|
600 |
|
| 582 |
/** |
601 |
/** |
|
Lines 641-647
Link Here
|
| 641 |
return new EStoreEcoreEMap(); |
660 |
return new EStoreEcoreEMap(); |
| 642 |
} |
661 |
} |
| 643 |
|
662 |
|
| 644 |
return new CDOStoreEList<Object>(eStructuralFeature); |
663 |
return super.createList(eStructuralFeature); |
| 645 |
} |
664 |
} |
| 646 |
|
665 |
|
| 647 |
@Override |
666 |
@Override |
|
Lines 682-760
Link Here
|
| 682 |
} |
701 |
} |
| 683 |
|
702 |
|
| 684 |
/** |
703 |
/** |
| 685 |
* Don't cache non-transient features in this CDOObject's {@link #eSettings()}. |
704 |
* @since 2.0 |
| 686 |
*/ |
705 |
*/ |
| 687 |
@Override |
706 |
@Override |
| 688 |
protected boolean eIsCaching() |
707 |
public InternalEObject.EStore eStore() |
| 689 |
{ |
|
|
| 690 |
return false; |
| 691 |
} |
| 692 |
|
| 693 |
@Override |
| 694 |
public Object dynamicGet(int dynamicFeatureID) |
| 695 |
{ |
708 |
{ |
| 696 |
if (FSMUtil.isTransient(this)) |
709 |
if (FSMUtil.isTransient(this)) |
| 697 |
{ |
710 |
{ |
| 698 |
if (eSettings == null) |
711 |
return CDOStoreSettingsImpl.TRANSIENT_STORE; |
| 699 |
{ |
|
|
| 700 |
return null; |
| 701 |
} |
| 702 |
|
| 703 |
return eSettings[dynamicFeatureID]; |
| 704 |
} |
| 705 |
|
| 706 |
// Delegate to CDOStore |
| 707 |
return super.dynamicGet(dynamicFeatureID); |
| 708 |
} |
| 709 |
|
| 710 |
@Override |
| 711 |
public boolean eIsSet(EStructuralFeature feature) |
| 712 |
{ |
| 713 |
if (FSMUtil.isTransient(this)) |
| 714 |
{ |
| 715 |
// TODO What about defaultValues != null? |
| 716 |
if (eSettings == null) |
| 717 |
{ |
| 718 |
return false; |
| 719 |
} |
| 720 |
|
| 721 |
return eSettings[eDynamicFeatureID(feature)] != null; |
| 722 |
} |
| 723 |
|
| 724 |
// Delegate to CDOStore |
| 725 |
return super.eIsSet(feature); |
| 726 |
} |
| 727 |
|
| 728 |
@Override |
| 729 |
public void dynamicSet(int dynamicFeatureID, Object value) |
| 730 |
{ |
| 731 |
if (FSMUtil.isTransient(this)) |
| 732 |
{ |
| 733 |
eSettings(); // Important to create eSettings array if necessary |
| 734 |
eSettings[dynamicFeatureID] = value; |
| 735 |
} |
| 736 |
else |
| 737 |
{ |
| 738 |
// Delegate to CDOStore |
| 739 |
super.dynamicSet(dynamicFeatureID, value); |
| 740 |
} |
712 |
} |
|
|
713 |
return getStore(); |
| 741 |
} |
714 |
} |
| 742 |
|
715 |
|
|
|
716 |
/** |
| 717 |
* Don't cache non-transient features in this CDOObject's {@link #eSettings()}. |
| 718 |
*/ |
| 743 |
@Override |
719 |
@Override |
| 744 |
public void dynamicUnset(int dynamicFeatureID) |
720 |
protected boolean eIsCaching() |
| 745 |
{ |
721 |
{ |
| 746 |
if (FSMUtil.isTransient(this)) |
722 |
return false; |
| 747 |
{ |
|
|
| 748 |
if (eSettings != null) |
| 749 |
{ |
| 750 |
eSettings[dynamicFeatureID] = null; |
| 751 |
} |
| 752 |
} |
| 753 |
else |
| 754 |
{ |
| 755 |
// Delegate to CDOStore |
| 756 |
super.dynamicUnset(dynamicFeatureID); |
| 757 |
} |
| 758 |
} |
723 |
} |
| 759 |
|
724 |
|
| 760 |
@Override |
725 |
@Override |
|
Lines 993-1206
Link Here
|
| 993 |
|
958 |
|
| 994 |
private CDOStore getStore() |
959 |
private CDOStore getStore() |
| 995 |
{ |
960 |
{ |
| 996 |
return (CDOStore)eStore(); |
961 |
return cdoView().getStore(); |
| 997 |
} |
962 |
} |
| 998 |
|
963 |
|
| 999 |
/** |
964 |
/** |
| 1000 |
* TODO Remove this when EMF has fixed http://bugs.eclipse.org/197487 |
965 |
* @since 2.0 |
| 1001 |
* |
|
|
| 1002 |
* @author Eike Stepper |
| 1003 |
*/ |
966 |
*/ |
| 1004 |
public class CDOStoreEList<E> extends DelegatingEcoreEList.Dynamic<E> |
967 |
public static class CDOStoreSettingsImpl implements InternalEObject.EStore |
| 1005 |
{ |
968 |
{ |
| 1006 |
private static final long serialVersionUID = 1L; |
969 |
protected static CDOStoreSettingsImpl TRANSIENT_STORE = new CDOStoreSettingsImpl(); |
| 1007 |
|
970 |
|
| 1008 |
public CDOStoreEList(EStructuralFeature eStructuralFeature) |
971 |
protected Object getValue(InternalEObject eObject, int dynamicFeatureID) |
| 1009 |
{ |
972 |
{ |
| 1010 |
super(CDOObjectImpl.this, eStructuralFeature); |
973 |
return ((CDOObjectImpl)eObject).eTransientSettings()[dynamicFeatureID]; |
| 1011 |
} |
|
|
| 1012 |
|
974 |
|
| 1013 |
@Override |
|
|
| 1014 |
protected List<E> delegateList() |
| 1015 |
{ |
| 1016 |
throw new UnsupportedOperationException(); |
| 1017 |
} |
975 |
} |
| 1018 |
|
976 |
|
| 1019 |
@Override |
977 |
protected EList<Object> getValueAsList(InternalEObject eObject, int dynamicFeatureID) |
| 1020 |
public EStructuralFeature getEStructuralFeature() |
|
|
| 1021 |
{ |
978 |
{ |
| 1022 |
return eStructuralFeature; |
979 |
@SuppressWarnings("unchecked") |
|
|
980 |
EList<Object> result = (EList<Object>)getValue(eObject, dynamicFeatureID); |
| 981 |
if (result == null) |
| 982 |
{ |
| 983 |
result = new BasicEList<Object>(); |
| 984 |
((CDOObjectImpl)eObject).eTransientSettings()[dynamicFeatureID] = result; |
| 985 |
} |
| 986 |
return result; |
| 1023 |
} |
987 |
} |
| 1024 |
|
988 |
|
| 1025 |
@Override |
989 |
protected Object setValue(InternalEObject eObject, int dynamicFeatureID, Object newValue) |
| 1026 |
protected void delegateAdd(int index, Object object) |
|
|
| 1027 |
{ |
990 |
{ |
| 1028 |
getStore().add(owner, eStructuralFeature, index, object); |
991 |
Object eSettings[] = ((CDOObjectImpl)eObject).eTransientSettings(); |
|
|
992 |
try |
| 993 |
{ |
| 994 |
return eSettings[dynamicFeatureID]; |
| 995 |
} |
| 996 |
finally |
| 997 |
{ |
| 998 |
eSettings[dynamicFeatureID] = newValue; |
| 999 |
} |
| 1029 |
} |
1000 |
} |
| 1030 |
|
1001 |
|
| 1031 |
@Override |
1002 |
protected int eDynamicFeatureID(InternalEObject eObject, EStructuralFeature feature) |
| 1032 |
protected void delegateAdd(Object object) |
|
|
| 1033 |
{ |
1003 |
{ |
| 1034 |
delegateAdd(delegateSize(), object); |
1004 |
return ((CDOObjectImpl)eObject).eDynamicFeatureID(feature); |
| 1035 |
} |
1005 |
} |
| 1036 |
|
1006 |
|
| 1037 |
@Override |
1007 |
public Object get(InternalEObject eObject, EStructuralFeature feature, int index) |
| 1038 |
protected List<E> delegateBasicList() |
|
|
| 1039 |
{ |
1008 |
{ |
| 1040 |
int size = delegateSize(); |
1009 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
| 1041 |
if (size == 0) |
1010 |
if (feature.isMany()) |
| 1042 |
{ |
1011 |
{ |
| 1043 |
return ECollections.emptyEList(); |
1012 |
return getValueAsList(eObject, dynamicFeatureID).get(index); |
| 1044 |
} |
1013 |
} |
| 1045 |
|
1014 |
return getValue(eObject, dynamicFeatureID); |
| 1046 |
Object[] data = getStore().toArray(owner, eStructuralFeature); |
|
|
| 1047 |
return new EcoreEList.UnmodifiableEList<E>(owner, eStructuralFeature, data.length, data); |
| 1048 |
} |
1015 |
} |
| 1049 |
|
1016 |
|
| 1050 |
@Override |
1017 |
public Object set(InternalEObject eObject, EStructuralFeature feature, int index, Object value) |
| 1051 |
protected void delegateClear() |
|
|
| 1052 |
{ |
1018 |
{ |
| 1053 |
getStore().clear(owner, eStructuralFeature); |
1019 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
|
|
1020 |
if (feature.isMany()) |
| 1021 |
{ |
| 1022 |
return getValueAsList(eObject, dynamicFeatureID).set(index, value); |
| 1023 |
} |
| 1024 |
return setValue(eObject, dynamicFeatureID, value); |
| 1054 |
} |
1025 |
} |
| 1055 |
|
1026 |
|
| 1056 |
@Override |
1027 |
public void add(InternalEObject eObject, EStructuralFeature feature, int index, Object value) |
| 1057 |
protected boolean delegateContains(Object object) |
|
|
| 1058 |
{ |
1028 |
{ |
| 1059 |
return getStore().contains(owner, eStructuralFeature, object); |
1029 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
|
|
1030 |
getValueAsList(eObject, dynamicFeatureID).add(index, value); |
| 1060 |
} |
1031 |
} |
| 1061 |
|
1032 |
|
| 1062 |
@Override |
1033 |
public Object remove(InternalEObject eObject, EStructuralFeature feature, int index) |
| 1063 |
protected boolean delegateContainsAll(Collection<?> collection) |
|
|
| 1064 |
{ |
1034 |
{ |
| 1065 |
for (Object o : collection) |
1035 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
| 1066 |
{ |
1036 |
return getValueAsList(eObject, dynamicFeatureID).remove(index); |
| 1067 |
if (!delegateContains(o)) |
|
|
| 1068 |
{ |
| 1069 |
return false; |
| 1070 |
} |
| 1071 |
} |
| 1072 |
return true; |
| 1073 |
} |
1037 |
} |
| 1074 |
|
1038 |
|
| 1075 |
@SuppressWarnings("unchecked") |
1039 |
public Object move(InternalEObject eObject, EStructuralFeature feature, int targetIndex, int sourceIndex) |
| 1076 |
@Override |
|
|
| 1077 |
protected E delegateGet(int index) |
| 1078 |
{ |
1040 |
{ |
| 1079 |
return (E)getStore().get(owner, eStructuralFeature, index); |
1041 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
|
|
1042 |
return getValueAsList(eObject, dynamicFeatureID).move(targetIndex, sourceIndex); |
| 1080 |
} |
1043 |
} |
| 1081 |
|
1044 |
|
| 1082 |
@Override |
1045 |
public void clear(InternalEObject eObject, EStructuralFeature feature) |
| 1083 |
protected int delegateHashCode() |
|
|
| 1084 |
{ |
1046 |
{ |
| 1085 |
return getStore().hashCode(owner, eStructuralFeature); |
1047 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
|
|
1048 |
if (feature.isMany()) |
| 1049 |
{ |
| 1050 |
getValueAsList(eObject, dynamicFeatureID).clear(); |
| 1051 |
} |
| 1052 |
setValue(eObject, dynamicFeatureID, null); |
| 1086 |
} |
1053 |
} |
| 1087 |
|
1054 |
|
| 1088 |
@Override |
1055 |
public int size(InternalEObject eObject, EStructuralFeature feature) |
| 1089 |
protected int delegateIndexOf(Object object) |
|
|
| 1090 |
{ |
1056 |
{ |
| 1091 |
return getStore().indexOf(owner, eStructuralFeature, object); |
1057 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
|
|
1058 |
return getValueAsList(eObject, dynamicFeatureID).size(); |
| 1092 |
} |
1059 |
} |
| 1093 |
|
1060 |
|
| 1094 |
@Override |
1061 |
public int indexOf(InternalEObject eObject, EStructuralFeature feature, Object value) |
| 1095 |
protected boolean delegateIsEmpty() |
|
|
| 1096 |
{ |
1062 |
{ |
| 1097 |
return getStore().isEmpty(owner, eStructuralFeature); |
1063 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
|
|
1064 |
return getValueAsList(eObject, dynamicFeatureID).indexOf(value); |
| 1098 |
} |
1065 |
} |
| 1099 |
|
1066 |
|
| 1100 |
@Override |
1067 |
public int lastIndexOf(InternalEObject eObject, EStructuralFeature feature, Object value) |
| 1101 |
protected Iterator<E> delegateIterator() |
|
|
| 1102 |
{ |
1068 |
{ |
| 1103 |
return iterator(); |
1069 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
|
|
1070 |
return getValueAsList(eObject, dynamicFeatureID).lastIndexOf(value); |
| 1104 |
} |
1071 |
} |
| 1105 |
|
1072 |
|
| 1106 |
@Override |
1073 |
public Object[] toArray(InternalEObject eObject, EStructuralFeature feature) |
| 1107 |
protected int delegateLastIndexOf(Object object) |
|
|
| 1108 |
{ |
1074 |
{ |
| 1109 |
return getStore().lastIndexOf(owner, eStructuralFeature, object); |
1075 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
|
|
1076 |
return getValueAsList(eObject, dynamicFeatureID).toArray(); |
| 1110 |
} |
1077 |
} |
| 1111 |
|
1078 |
|
| 1112 |
@Override |
1079 |
public <T> T[] toArray(InternalEObject eObject, EStructuralFeature feature, T[] array) |
| 1113 |
protected ListIterator<E> delegateListIterator() |
|
|
| 1114 |
{ |
1080 |
{ |
| 1115 |
return listIterator(); |
1081 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
|
|
1082 |
return getValueAsList(eObject, dynamicFeatureID).toArray(array); |
| 1116 |
} |
1083 |
} |
| 1117 |
|
1084 |
|
| 1118 |
@SuppressWarnings("unchecked") |
1085 |
public boolean isEmpty(InternalEObject eObject, EStructuralFeature feature) |
| 1119 |
@Override |
|
|
| 1120 |
protected E delegateRemove(int index) |
| 1121 |
{ |
1086 |
{ |
| 1122 |
return (E)getStore().remove(owner, eStructuralFeature, index); |
1087 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
|
|
1088 |
return getValueAsList(eObject, dynamicFeatureID).isEmpty(); |
| 1123 |
} |
1089 |
} |
| 1124 |
|
1090 |
|
| 1125 |
@SuppressWarnings("unchecked") |
1091 |
public boolean contains(InternalEObject eObject, EStructuralFeature feature, Object value) |
| 1126 |
@Override |
|
|
| 1127 |
protected E delegateSet(int index, E object) |
| 1128 |
{ |
1092 |
{ |
| 1129 |
return (E)getStore().set(owner, eStructuralFeature, index, object); |
1093 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
|
|
1094 |
return getValueAsList(eObject, dynamicFeatureID).contains(value); |
| 1130 |
} |
1095 |
} |
| 1131 |
|
1096 |
|
| 1132 |
@Override |
1097 |
public int hashCode(InternalEObject eObject, EStructuralFeature feature) |
| 1133 |
protected int delegateSize() |
|
|
| 1134 |
{ |
1098 |
{ |
| 1135 |
return getStore().size(owner, eStructuralFeature); |
1099 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
|
|
1100 |
return getValueAsList(eObject, dynamicFeatureID).hashCode(); |
| 1136 |
} |
1101 |
} |
| 1137 |
|
1102 |
|
| 1138 |
@Override |
1103 |
public InternalEObject getContainer(InternalEObject eObject) |
| 1139 |
protected Object[] delegateToArray() |
|
|
| 1140 |
{ |
1104 |
{ |
| 1141 |
return getStore().toArray(owner, eStructuralFeature); |
1105 |
return null; |
| 1142 |
} |
1106 |
} |
| 1143 |
|
1107 |
|
| 1144 |
@Override |
1108 |
public EStructuralFeature getContainingFeature(InternalEObject eObject) |
| 1145 |
protected <T> T[] delegateToArray(T[] array) |
|
|
| 1146 |
{ |
1109 |
{ |
| 1147 |
return getStore().toArray(owner, eStructuralFeature, array); |
1110 |
// This should never be called. |
|
|
1111 |
// |
| 1112 |
throw new UnsupportedOperationException(); |
| 1113 |
// Entry entry = new Entry(eObject, CONTAINING_FEATURE); |
| 1114 |
// return (EStructuralFeature)map.get(entry); |
| 1148 |
} |
1115 |
} |
| 1149 |
|
1116 |
|
| 1150 |
@SuppressWarnings("unchecked") |
1117 |
public EObject create(EClass eClass) |
| 1151 |
@Override |
|
|
| 1152 |
protected E delegateMove(int targetIndex, int sourceIndex) |
| 1153 |
{ |
1118 |
{ |
| 1154 |
return (E)getStore().move(owner, eStructuralFeature, targetIndex, sourceIndex); |
1119 |
InternalEObject result = new EStoreEObjectImpl(eClass, this); |
|
|
1120 |
return result; |
| 1155 |
} |
1121 |
} |
| 1156 |
|
1122 |
|
| 1157 |
@Override |
1123 |
public boolean isSet(InternalEObject eObject, EStructuralFeature feature) |
| 1158 |
protected boolean delegateEquals(Object object) |
|
|
| 1159 |
{ |
1124 |
{ |
| 1160 |
if (object == this) |
1125 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
| 1161 |
{ |
1126 |
return getValue(eObject, dynamicFeatureID) != null; |
| 1162 |
return true; |
|
|
| 1163 |
} |
| 1164 |
|
| 1165 |
if (!(object instanceof List)) |
| 1166 |
{ |
| 1167 |
return false; |
| 1168 |
} |
| 1169 |
|
| 1170 |
List<?> list = (List<?>)object; |
| 1171 |
if (list.size() != delegateSize()) |
| 1172 |
{ |
| 1173 |
return false; |
| 1174 |
} |
| 1175 |
|
| 1176 |
for (ListIterator<?> i = list.listIterator(); i.hasNext();) |
| 1177 |
{ |
| 1178 |
Object element = i.next(); |
| 1179 |
if (element == null ? get(i.previousIndex()) != null : !element.equals(get(i.previousIndex()))) |
| 1180 |
{ |
| 1181 |
return false; |
| 1182 |
} |
| 1183 |
} |
| 1184 |
|
| 1185 |
return true; |
| 1186 |
} |
1127 |
} |
| 1187 |
|
1128 |
|
| 1188 |
@Override |
1129 |
public void unset(InternalEObject eObject, EStructuralFeature feature) |
| 1189 |
protected String delegateToString() |
|
|
| 1190 |
{ |
1130 |
{ |
| 1191 |
StringBuffer stringBuffer = new StringBuffer(); |
1131 |
int dynamicFeatureID = eDynamicFeatureID(eObject, feature); |
| 1192 |
stringBuffer.append("["); |
1132 |
setValue(eObject, dynamicFeatureID, null); |
| 1193 |
for (int i = 0, size = size(); i < size;) |
|
|
| 1194 |
{ |
| 1195 |
Object value = delegateGet(i); |
| 1196 |
stringBuffer.append(String.valueOf(value)); |
| 1197 |
if (++i < size) |
| 1198 |
{ |
| 1199 |
stringBuffer.append(", "); |
| 1200 |
} |
| 1201 |
} |
| 1202 |
stringBuffer.append("]"); |
| 1203 |
return stringBuffer.toString(); |
| 1204 |
} |
1133 |
} |
| 1205 |
} |
1134 |
} |
| 1206 |
|
1135 |
|
|
Lines 1233-1239
Link Here
|
| 1233 |
@Override |
1162 |
@Override |
| 1234 |
protected void delegateAdd(int index, Entry object) |
1163 |
protected void delegateAdd(int index, Entry object) |
| 1235 |
{ |
1164 |
{ |
| 1236 |
getStore().add(owner, eStructuralFeature, index, object); |
1165 |
eStore().add(owner, eStructuralFeature, index, object); |
| 1237 |
} |
1166 |
} |
| 1238 |
|
1167 |
|
| 1239 |
@Override |
1168 |
@Override |
|
Lines 1258-1270
Link Here
|
| 1258 |
@Override |
1187 |
@Override |
| 1259 |
protected void delegateClear() |
1188 |
protected void delegateClear() |
| 1260 |
{ |
1189 |
{ |
| 1261 |
getStore().clear(owner, eStructuralFeature); |
1190 |
eStore().clear(owner, eStructuralFeature); |
| 1262 |
} |
1191 |
} |
| 1263 |
|
1192 |
|
| 1264 |
@Override |
1193 |
@Override |
| 1265 |
protected boolean delegateContains(Object object) |
1194 |
protected boolean delegateContains(Object object) |
| 1266 |
{ |
1195 |
{ |
| 1267 |
return getStore().contains(owner, eStructuralFeature, object); |
1196 |
return eStore().contains(owner, eStructuralFeature, object); |
| 1268 |
} |
1197 |
} |
| 1269 |
|
1198 |
|
| 1270 |
@Override |
1199 |
@Override |
|
Lines 1283-1307
Link Here
|
| 1283 |
@Override |
1212 |
@Override |
| 1284 |
protected Entry delegateGet(int index) |
1213 |
protected Entry delegateGet(int index) |
| 1285 |
{ |
1214 |
{ |
| 1286 |
return (Entry)getStore().get(owner, eStructuralFeature, index); |
1215 |
return (Entry)eStore().get(owner, eStructuralFeature, index); |
| 1287 |
} |
1216 |
} |
| 1288 |
|
1217 |
|
| 1289 |
@Override |
1218 |
@Override |
| 1290 |
protected int delegateHashCode() |
1219 |
protected int delegateHashCode() |
| 1291 |
{ |
1220 |
{ |
| 1292 |
return getStore().hashCode(owner, eStructuralFeature); |
1221 |
return eStore().hashCode(owner, eStructuralFeature); |
| 1293 |
} |
1222 |
} |
| 1294 |
|
1223 |
|
| 1295 |
@Override |
1224 |
@Override |
| 1296 |
protected int delegateIndexOf(Object object) |
1225 |
protected int delegateIndexOf(Object object) |
| 1297 |
{ |
1226 |
{ |
| 1298 |
return getStore().indexOf(owner, eStructuralFeature, object); |
1227 |
return eStore().indexOf(owner, eStructuralFeature, object); |
| 1299 |
} |
1228 |
} |
| 1300 |
|
1229 |
|
| 1301 |
@Override |
1230 |
@Override |
| 1302 |
protected boolean delegateIsEmpty() |
1231 |
protected boolean delegateIsEmpty() |
| 1303 |
{ |
1232 |
{ |
| 1304 |
return getStore().isEmpty(owner, eStructuralFeature); |
1233 |
return eStore().isEmpty(owner, eStructuralFeature); |
| 1305 |
} |
1234 |
} |
| 1306 |
|
1235 |
|
| 1307 |
@Override |
1236 |
@Override |
|
Lines 1313-1319
Link Here
|
| 1313 |
@Override |
1242 |
@Override |
| 1314 |
protected int delegateLastIndexOf(Object object) |
1243 |
protected int delegateLastIndexOf(Object object) |
| 1315 |
{ |
1244 |
{ |
| 1316 |
return getStore().lastIndexOf(owner, eStructuralFeature, object); |
1245 |
return eStore().lastIndexOf(owner, eStructuralFeature, object); |
| 1317 |
} |
1246 |
} |
| 1318 |
|
1247 |
|
| 1319 |
@Override |
1248 |
@Override |
|
Lines 1325-1361
Link Here
|
| 1325 |
@Override |
1254 |
@Override |
| 1326 |
protected Entry delegateRemove(int index) |
1255 |
protected Entry delegateRemove(int index) |
| 1327 |
{ |
1256 |
{ |
| 1328 |
return (Entry)getStore().remove(owner, eStructuralFeature, index); |
1257 |
return (Entry)eStore().remove(owner, eStructuralFeature, index); |
| 1329 |
} |
1258 |
} |
| 1330 |
|
1259 |
|
| 1331 |
@Override |
1260 |
@Override |
| 1332 |
protected Entry delegateSet(int index, Entry object) |
1261 |
protected Entry delegateSet(int index, Entry object) |
| 1333 |
{ |
1262 |
{ |
| 1334 |
return (Entry)getStore().set(owner, eStructuralFeature, index, object); |
1263 |
return (Entry)eStore().set(owner, eStructuralFeature, index, object); |
| 1335 |
} |
1264 |
} |
| 1336 |
|
1265 |
|
| 1337 |
@Override |
1266 |
@Override |
| 1338 |
protected int delegateSize() |
1267 |
protected int delegateSize() |
| 1339 |
{ |
1268 |
{ |
| 1340 |
return getStore().size(owner, eStructuralFeature); |
1269 |
return eStore().size(owner, eStructuralFeature); |
| 1341 |
} |
1270 |
} |
| 1342 |
|
1271 |
|
| 1343 |
@Override |
1272 |
@Override |
| 1344 |
protected Object[] delegateToArray() |
1273 |
protected Object[] delegateToArray() |
| 1345 |
{ |
1274 |
{ |
| 1346 |
return getStore().toArray(owner, eStructuralFeature); |
1275 |
return eStore().toArray(owner, eStructuralFeature); |
| 1347 |
} |
1276 |
} |
| 1348 |
|
1277 |
|
| 1349 |
@Override |
1278 |
@Override |
| 1350 |
protected <T> T[] delegateToArray(T[] array) |
1279 |
protected <T> T[] delegateToArray(T[] array) |
| 1351 |
{ |
1280 |
{ |
| 1352 |
return getStore().toArray(owner, eStructuralFeature, array); |
1281 |
return eStore().toArray(owner, eStructuralFeature, array); |
| 1353 |
} |
1282 |
} |
| 1354 |
|
1283 |
|
| 1355 |
@Override |
1284 |
@Override |
| 1356 |
protected Entry delegateMove(int targetIndex, int sourceIndex) |
1285 |
protected Entry delegateMove(int targetIndex, int sourceIndex) |
| 1357 |
{ |
1286 |
{ |
| 1358 |
return (Entry)getStore().move(owner, eStructuralFeature, targetIndex, sourceIndex); |
1287 |
return (Entry)eStore().move(owner, eStructuralFeature, targetIndex, sourceIndex); |
| 1359 |
} |
1288 |
} |
| 1360 |
|
1289 |
|
| 1361 |
@Override |
1290 |
@Override |