Class AbstractChangeFactory
- java.lang.Object
-
- org.eclipse.emf.compare.internal.postprocessor.factories.AbstractChangeFactory
-
- All Implemented Interfaces:
IChangeFactory
public abstract class AbstractChangeFactory extends Object implements IChangeFactory
Factory of difference extensions.
-
-
Constructor Summary
Constructors Constructor Description AbstractChangeFactory()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Diff
create(Diff input)
abstract Diff
createExtension()
It creates the graphical change extension.void
fillRequiredDifferences(Comparison comparison, Diff extension)
Sets the required link of the difference extension created by the related factory.
It has to be called when all the extensions are created.protected List<Diff>
findCrossReferences(Comparison comparison, EObject lookup, com.google.common.base.Predicate<Diff> p)
Find the differences, on the given model object, which match with the predicate.protected Set<Diff>
getAllContainedDifferences(Diff input)
Get all the add and delete changes on the objects contained in the one concerned by the given difference.Class<? extends Diff>
getExtensionKind()
Returns the kind of extension that this factory has to create.Match
getParentMatch(Diff input)
Returns the match in which the difference will be added.protected DifferenceKind
getRelatedExtensionKind(Diff input)
Get theDifferenceKind
of the matching diagram difference extension in relation to the given difference.boolean
handles(Diff input)
Returns true if this factory handles the given kind of Diff, i.e., if it can create anextension
.protected boolean
isRelatedToAnExtensionAdd(AttributeChange input)
Check if the given attribute change is related to a graphical add.protected boolean
isRelatedToAnExtensionAdd(ReferenceChange input)
Check if the given reference change is related to a graphical add.protected boolean
isRelatedToAnExtensionAdd(ResourceAttachmentChange input)
Check if the given resource attachment change is related to a graphical add.protected boolean
isRelatedToAnExtensionChange(AttributeChange input)
Check if the given attribute change is related to a graphical change.protected boolean
isRelatedToAnExtensionChange(ReferenceChange input)
Check if the given reference change is related to a graphical change.protected boolean
isRelatedToAnExtensionChange(ResourceAttachmentChange input)
Check if the given resource attachment change is related to a graphical change.protected boolean
isRelatedToAnExtensionDelete(AttributeChange input)
Check if the given attribute change is related to a graphical delete.protected boolean
isRelatedToAnExtensionDelete(ReferenceChange input)
Check if the given reference change is related to a graphical delete.protected boolean
isRelatedToAnExtensionDelete(ResourceAttachmentChange input)
Check if the given resource attachment change is related to a graphical delete.protected boolean
isRelatedToAnExtensionMove(AttributeChange input)
Check if the given attribute change is related to a graphical move.protected boolean
isRelatedToAnExtensionMove(ReferenceChange input)
Check if the given reference change is related to a graphical move.protected boolean
isRelatedToAnExtensionMove(ResourceAttachmentChange input)
Check if the given resource attachment change is related to a graphical ;ove.abstract void
setRefiningChanges(Diff extension, DifferenceKind extensionKind, Diff refiningDiff)
Get the refining differences and set the given extension with them, from the given refining one.
-
-
-
Method Detail
-
handles
public boolean handles(Diff input)
Returns true if this factory handles the given kind of Diff, i.e., if it can create anextension
.Performance note: this method should return as quickly as possible as it will called on every
Diff
of the Comparison.- Specified by:
handles
in interfaceIChangeFactory
- Parameters:
input
- the element to test- Returns:
- true if this factory handles the given input, false otherwise.
- See Also:
IChangeFactory.handles(org.eclipse.emf.compare.Diff)
-
create
public Diff create(Diff input)
Creates and returns aextension
from the givenDiff
. The returned element MUST NOT be added to its parent, it will be done by the post processor.- Specified by:
create
in interfaceIChangeFactory
- Parameters:
input
- The input difference element.- Returns:
- The difference extension.
- See Also:
IChangeFactory.create(org.eclipse.emf.compare.Diff)
-
createExtension
public abstract Diff createExtension()
It creates the graphical change extension.- Returns:
- The extension.
-
setRefiningChanges
public abstract void setRefiningChanges(Diff extension, DifferenceKind extensionKind, Diff refiningDiff)
Get the refining differences and set the given extension with them, from the given refining one.- Parameters:
extension
- The extension to set.extensionKind
- The extension kind.refiningDiff
- The refining difference.
-
getParentMatch
public Match getParentMatch(Diff input)
Returns the match in which the difference will be added.- Specified by:
getParentMatch
in interfaceIChangeFactory
- Parameters:
input
- The input difference element.- Returns:
- The difference extension.
- See Also:
IChangeFactory.getParentMatch(org.eclipse.emf.compare.Diff)
-
getExtensionKind
public Class<? extends Diff> getExtensionKind()
Returns the kind of extension that this factory has to create.- Specified by:
getExtensionKind
in interfaceIChangeFactory
- Returns:
- The kind of extension.
- See Also:
IChangeFactory.getExtensionKind()
-
fillRequiredDifferences
public void fillRequiredDifferences(Comparison comparison, Diff extension)
Sets the required link of the difference extension created by the related factory.
It has to be called when all the extensions are created.- Specified by:
fillRequiredDifferences
in interfaceIChangeFactory
- Parameters:
comparison
- The comparison.extension
- The difference extension.- See Also:
IChangeFactory.fillRequiredDifferences(org.eclipse.emf.compare.Comparison, org.eclipse.emf.compare.Diff)
-
getRelatedExtensionKind
protected DifferenceKind getRelatedExtensionKind(Diff input)
Get theDifferenceKind
of the matching diagram difference extension in relation to the given difference.- Parameters:
input
- The given difference.- Returns:
- The kind of the diagram difference extension if this one exists, null otherwise.
-
isRelatedToAnExtensionAdd
protected boolean isRelatedToAnExtensionAdd(ReferenceChange input)
Check if the given reference change is related to a graphical add. It may be overridden in the child factories in order to precise which kind of graphical add has to be considered.- Parameters:
input
- The reference change.- Returns:
- True if the reference change is a good candidate, false otherwise.
-
isRelatedToAnExtensionDelete
protected boolean isRelatedToAnExtensionDelete(ReferenceChange input)
Check if the given reference change is related to a graphical delete. It may be overridden in the child factories in order to precise which kind of graphical delete has to be considered.- Parameters:
input
- The reference change.- Returns:
- True if the reference change is a good candidate, false otherwise.
-
isRelatedToAnExtensionChange
protected boolean isRelatedToAnExtensionChange(ReferenceChange input)
Check if the given reference change is related to a graphical change. It may be overridden in the child factories in order to precise which kind of graphical change has to be considered.- Parameters:
input
- The reference change.- Returns:
- True if the reference change is a good candidate, false otherwise.
-
isRelatedToAnExtensionMove
protected boolean isRelatedToAnExtensionMove(ReferenceChange input)
Check if the given reference change is related to a graphical move. It may be overridden in the child factories in order to precise which kind of graphical move has to be considered.- Parameters:
input
- The reference change.- Returns:
- True if the reference change is a good candidate, false otherwise.
-
isRelatedToAnExtensionAdd
protected boolean isRelatedToAnExtensionAdd(AttributeChange input)
Check if the given attribute change is related to a graphical add. It may be overridden in the child factories in order to precise which kind of graphical add has to be considered.- Parameters:
input
- The attribute change.- Returns:
- True if the attribute change is a good candidate, false otherwise.
-
isRelatedToAnExtensionDelete
protected boolean isRelatedToAnExtensionDelete(AttributeChange input)
Check if the given attribute change is related to a graphical delete. It may be overridden in the child factories in order to precise which kind of graphical delete has to be considered.- Parameters:
input
- The attribute change.- Returns:
- True if the attribute change is a good candidate, false otherwise.
-
isRelatedToAnExtensionChange
protected boolean isRelatedToAnExtensionChange(AttributeChange input)
Check if the given attribute change is related to a graphical change. It may be overridden in the child factories in order to precise which kind of graphical change has to be considered.- Parameters:
input
- The attribute change.- Returns:
- True if the attribute change is a good candidate, false otherwise.
-
isRelatedToAnExtensionMove
protected boolean isRelatedToAnExtensionMove(AttributeChange input)
Check if the given attribute change is related to a graphical move. It may be overridden in the child factories in order to precise which kind of graphical move has to be considered.- Parameters:
input
- The attribute change.- Returns:
- True if the attribute change is a good candidate, false otherwise.
-
isRelatedToAnExtensionAdd
protected boolean isRelatedToAnExtensionAdd(ResourceAttachmentChange input)
Check if the given resource attachment change is related to a graphical add. It may be overridden in the child factories in order to precise which kind of graphical add has to be considered.- Parameters:
input
- The resource attachment change.- Returns:
- True if the resource attachment change is a good candidate, false otherwise.
-
isRelatedToAnExtensionDelete
protected boolean isRelatedToAnExtensionDelete(ResourceAttachmentChange input)
Check if the given resource attachment change is related to a graphical delete. It may be overridden in the child factories in order to precise which kind of graphical delete has to be considered.- Parameters:
input
- The resource attachment change.- Returns:
- True if the resource attachment change is a good candidate, false otherwise.
-
isRelatedToAnExtensionChange
protected boolean isRelatedToAnExtensionChange(ResourceAttachmentChange input)
Check if the given resource attachment change is related to a graphical change. It may be overridden in the child factories in order to precise which kind of graphical change has to be considered.- Parameters:
input
- The resource attachment change.- Returns:
- True if the resource attachment change is a good candidate, false otherwise.
-
isRelatedToAnExtensionMove
protected boolean isRelatedToAnExtensionMove(ResourceAttachmentChange input)
Check if the given resource attachment change is related to a graphical ;ove. It may be overridden in the child factories in order to precise which kind of graphical ;ove has to be considered.- Parameters:
input
- The resource attachment change.- Returns:
- True if the resource attachment change is a good candidate, false otherwise.
-
getAllContainedDifferences
protected Set<Diff> getAllContainedDifferences(Diff input)
Get all the add and delete changes on the objects contained in the one concerned by the given difference.- Parameters:
input
- The given difference.- Returns:
- The found differences.
-
findCrossReferences
protected final List<Diff> findCrossReferences(Comparison comparison, EObject lookup, com.google.common.base.Predicate<Diff> p)
Find the differences, on the given model object, which match with the predicate.- Parameters:
comparison
- The comparison.lookup
- The model object.p
- The predicate.- Returns:
- The found differences.
-
-