org.electrocodeogram.cpc.core.api.provider.reconciler
Interface IReconcilerProvider

All Superinterfaces:
IProvider

public interface IReconcilerProvider
extends IProvider

Interface for external modification reconciliation providers.
Only one reconciler can be active at any point in time. However, a reconciler will typically allow other modules to contribute their own reconciliation sub-strategies.

Author:
vw

Method Summary
 IReconciliationResult reconcile(ICloneFile cloneFile, java.util.List<IClone> persistedClones, java.lang.String persistedFileContent, java.lang.String newFileContent, boolean notifyUser)
          Tries to reconcile an external modification of a clone file and the internal clone data.
 
Methods inherited from interface org.electrocodeogram.cpc.core.api.provider.IProvider
getProviderName, toString
 

Method Detail

reconcile

IReconciliationResult reconcile(ICloneFile cloneFile,
                                java.util.List<IClone> persistedClones,
                                java.lang.String persistedFileContent,
                                java.lang.String newFileContent,
                                boolean notifyUser)
Tries to reconcile an external modification of a clone file and the internal clone data.
Takes the existing clone data and tries to identify the new positions and sizes in the new file content.
Clones may be moved, modified or deleted. No new clones may be added by the reconciler.

A reconciler does not access or modify the corresponding clone file via the file system and does not modify the clone data directly, i.e. via the IStoreProvider.
A reconciler may not have any side effects.

After the reconciler returns, the non-removed clone data remaining in the IReconciliationResult must be valid. All clones for which the new position could not be calculated must be listed in the IReconciliationResult's removedClones list.

If no reconciliation is needed, the reconciler returns a IReconciliationResult where all clone lists are null.

Parameters:
cloneFile - the clone file which was modified, never null.
persistedClones - the currently persisted clone data for the file, never null. Clone list is sorted by start offset.
persistedFileContent - the currently persisted content for the file, may be NULL.
newFileContent - the new content which was produced by some external modification to the file, may be NULL.
notifyUser - true if the user should be notified about this reconciliation (or rather the fact that an external modification has taken place). The user should at least be offered two choices: try to reconcile changes or drop all clone data for file. It is up to the provider implementation to decide on a suitable way of displaying this information to the user (i.e. a simple dialog or an entire wizard).
Returns:
a valid reconciliation result, never null.