Package org.eclipse.emf.compare.domain.impl

# Class EMFCompareChangeRecorder

java.lang.Object
org.eclipse.emf.ecore.change.util.ListDifferenceAnalyzer
org.eclipse.emf.ecore.change.util.BasicChangeRecorder
org.eclipse.emf.ecore.change.util.ChangeRecorder
org.eclipse.emf.compare.domain.impl.EMFCompareChangeRecorder

All Implemented Interfaces:
  `Adapter`, `Adapter.Internal`

public class EMFCompareChangeRecorder extends ChangeRecorder
This custom implementation of a change recorder will avoid copying the internal lists every time they're needed as they can grow to very large sizes along with the size of the compared models.

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter

`Adapter.Internal`

## Field Summary

### Fields inherited from class org.eclipse.emf.ecore.change.util.ChangeRecorder

`eObjectToProxyURIMap, loadingTargets, originalTargetObjects, resolveProxies, targetObjects`

### Fields inherited from class org.eclipse.emf.ecore.change.util.BasicChangeRecorder

`changeDescription, recording, recordingTransientFeatures`

## Constructor Summary

Constructors
Constructor
Description
`EMFCompareChangeRecorder()`

## Method Summary

Modifier and Type
Method
Description
`void`
`beginRecording(ChangeDescription changeDescription, Collection<?> rootObjects)`
This avoids growing the "originalTargetObjects" and "setOriginalTargetObjects" collections indefinitely during the same comparison each time a merge is executed.
`protected void`
`consolidateChanges()`
See bug 562321.
`protected ChangeDescription`
`createChangeDescription()`
`protected void`
`handleFeature(EStructuralFeature feature, EReference containment, Notification notification, EObject eObject)`
The "setOriginalTargetObjects" Set is used to register target objects instead of the "originalTargetObjects" list to avoid duplicates, and fill this list with the bare minimum afterwards, for optimization purposes.
`void`
`setTarget(Notifier target)`
Overrides the superclass method to ignore the "originalTargetObjets" list since we never resume recording a paused change description.

### Methods inherited from class org.eclipse.emf.ecore.change.util.ChangeRecorder

`addAdapter, beginRecording, dispose, getEObjectToProxyURIMap, getTarget, handleResource, handleTarget, isAdapterForType, isOrphan, isResolveProxies, notifyChanged, prepareChangeDescriptionForResume, removeAdapter, setEObjectToProxyURIMap, setResolveProxies, shouldRecord, unsetTarget`

### Methods inherited from class org.eclipse.emf.ecore.change.util.BasicChangeRecorder

`createFeatureChange, createResourceChange, eliminateEmptyChanges, endRecording, finalizeChange, finalizeChange, getChangeDescription, getFeatureChange, getFeatureChanges, getResourceChange, getResourceChanges, isRecording, isRecordingTransientFeatures, setChangeDescription, setRecording, setRecordingTransientFeatures, shouldRecord, summarize`

### Methods inherited from class org.eclipse.emf.ecore.change.util.ListDifferenceAnalyzer

`analyzeLists, analyzeLists, createAddListChange, createListChange, createListChanges, createMoveListChange, createRemoveListChange, equal`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### EMFCompareChangeRecorder

public EMFCompareChangeRecorder()

## Method Details

### setTarget

public void setTarget(Notifier target)
Overrides the superclass method to ignore the "originalTargetObjets" list since we never resume recording a paused change description.

Specified by:
  `setTarget` in interface `Adapter`
Overrides:
  `setTarget` in class `ChangeRecorder`

### handleFeature

protected void handleFeature(EStructuralFeature feature, EReference containment, Notification notification, EObject eObject)
The "setOriginalTargetObjects" Set is used to register target objects instead of the "originalTargetObjects" list to avoid duplicates, and fill this list with the bare minimum afterwards, for optimization purposes.

Overrides:
  `handleFeature` in class `ChangeRecorder`

### beginRecording

public void beginRecording(ChangeDescription changeDescription, Collection<?> rootObjects)
This avoids growing the "originalTargetObjects" and "setOriginalTargetObjects" collections indefinitely during the same comparison each time a merge is executed.

Overrides:
  `beginRecording` in class `ChangeRecorder`

### consolidateChanges

protected void consolidateChanges()
See bug 562321. Some Sirius objects that changed during merging may become orphans and were removed by the org.eclipse.emf.ecore.change.util.ChangeRecorder#consolidateChanges() method. So we fill the originalTargetObjects list with these orphaned objects to keep them.

Overrides:
  `consolidateChanges` in class `ChangeRecorder`

### createChangeDescription

protected ChangeDescription createChangeDescription()

Overrides:
  `createChangeDescription` in class `BasicChangeRecorder`