Class AbstractConflictSearch<T extends Diff>
java.lang.Object
org.eclipse.emf.compare.internal.conflict.AbstractConflictSearch<T>
- Type Parameters:
T- The type of diff for which conflict are researched
- Direct Known Subclasses:
AttributeChangeConflictSearch.Add,AttributeChangeConflictSearch.Change,AttributeChangeConflictSearch.Delete,AttributeChangeConflictSearch.Move,ContainmentRefChangeConflictSearch.Add,ContainmentRefChangeConflictSearch.Change,ContainmentRefChangeConflictSearch.Delete,ContainmentRefChangeConflictSearch.Move,FeatureMapChangeConflictSearch.Add,FeatureMapChangeConflictSearch.Change,FeatureMapChangeConflictSearch.Delete,FeatureMapChangeConflictSearch.Move,NonContainmentRefChangeConflictSearch.Add,NonContainmentRefChangeConflictSearch.Change,NonContainmentRefChangeConflictSearch.Delete,NonContainmentRefChangeConflictSearch.Move,ResourceAttachmentChangeConflictSearch.Add,ResourceAttachmentChangeConflictSearch.Change,ResourceAttachmentChangeConflictSearch.Delete,ResourceAttachmentChangeConflictSearch.Move
Class in charge of finding conflicting diffs for a given diff of type T.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ComparisonThe comparison that contains diff.protected final TThe difference, nevernull.protected final ComparisonIndexThe index of the comparison.protected final MonitorThe monitor to report progress to. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractConflictSearch(T diff, ComparisonIndex index, Monitor monitor) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanareMergeableStringAttributeChanges(Diff diff1, Diff diff2) Specifies whether the two given diffs,diff1anddiff2, are bothattribute changesof String attributes and can be merged with a line-based three-way merge.protected voidconflict(Diff other, ConflictKind kind) This will be called whenever we detect a new conflict in order to create (or update) the actual association.abstract voidDetect conflicts withdiffin its comparison.protected StringgetChangedValue(AttributeChange attributeChange) Returns the changed attribute value denoted by the givendiff.Get the diffs in the sameMatchas diff.protected FeatureFiltergetFeatureFilter(Comparison comp) Returns the feature filter attached to the given comparison if any.protected MatchResourcegetMatchResource(Resource resource) Returns the MatchResource corresponding to the givenresource.protected EObjectProvide the model element the given diff applies to.protected EObjectProvide the non-null model element the given diff applies to.This predicate will betruefor any Match which represents a containment deletion.protected booleanisFeatureMapChange(Diff toCheck) Specifies whether the givendiffis aFeatureMapChange.protected booleanisFeatureMapChangeOrMergeableStringAttributeChange(Diff diff1, Diff diff2) Specifies whether the givendiff1anddiff2are eitherfeature map changesor mergeableattribute changesof String attributes.protected booleanisMergeable(AttributeChange diff1, AttributeChange diff2) Specifies whether the two given attribute changes,diff1anddiff2, can be merged with a line-based three-way merge.protected booleanisMergeableText(String left, String right, String origin) Specifies whether the given three versions of a textleft,right, andoriginare mergeable with a line-based three-way merge.protected booleanisStringAttributeChange(Diff toCheck) Specifies whether the givendiffis aAttributeChangeof a String attribute.
-
Field Details
-
diff
The difference, nevernull. -
comparison
The comparison that contains diff. -
index
The index of the comparison. -
monitor
The monitor to report progress to.
-
-
Constructor Details
-
AbstractConflictSearch
Constructor.- Parameters:
diff- The diff to search conflicts with, must not benulland have a non-null match that belongs to a non-null comparison. It must also have a non-nullDifferenceKindandDifferenceSource.index- Comparison index, must not be nullmonitor- the monitor to report progress to, must not be null
-
-
Method Details
-
detectConflicts
public abstract void detectConflicts()Detect conflicts withdiffin its comparison. This will add or update conflicts indiff's comparison. -
getDiffsInSameMatch
Get the diffs in the sameMatchas diff.- Returns:
- A never-null EList of differences in the same
Matchas diff, including diff.
-
isFeatureMapChangeOrMergeableStringAttributeChange
Specifies whether the givendiff1anddiff2are eitherfeature map changesor mergeableattribute changesof String attributes.- Parameters:
diff1- One of the diffs to check.diff2- The other diff to check.- Returns:
trueif it is aFeatureMapChangeor a mergeableAttributeChange,falseotherwise.
-
isFeatureMapChange
Specifies whether the givendiffis aFeatureMapChange.- Parameters:
toCheck- The diff to check.- Returns:
trueif it is aFeatureMapChange,falseotherwise.
-
areMergeableStringAttributeChanges
Specifies whether the two given diffs,diff1anddiff2, are bothattribute changesof String attributes and can be merged with a line-based three-way merge.- Parameters:
diff1- One of the diffs to check.diff2- The other diff to check.- Returns:
trueif the diffs are mergeable changes of a string attribute,falseotherwise.- See Also:
-
isStringAttributeChange
Specifies whether the givendiffis aAttributeChangeof a String attribute.- Parameters:
toCheck- The diff to check.- Returns:
trueif it is aAttributeChangeof a String attribute,falseotherwise.
-
isMergeable
Specifies whether the two given attribute changes,diff1anddiff2, can be merged with a line-based three-way merge.- Parameters:
diff1- One of the attribute changes to check.diff2- The other attribute change to check.- Returns:
trueif the attribute changes are mergeable,falseotherwise.- See Also:
-
isMergeableText
Specifies whether the given three versions of a textleft,right, andoriginare mergeable with a line-based three-way merge.- Parameters:
left- The left version.right- The right version.origin- The original version.- Returns:
trueif they are mergeable, false otherwise.- Since:
- 3.2
-
getChangedValue
Returns the changed attribute value denoted by the givendiff.- Parameters:
attributeChange- The attribute change for which the changed value is requested.- Returns:
- The changed attribute value.
-
conflict
This will be called whenever we detect a new conflict in order to create (or update) the actual association.- Parameters:
other- Second of the two differences for which we detected a conflict.kind- Kind of this conflict.
-
getMatchResource
Returns the MatchResource corresponding to the givenresource.- Parameters:
resource- Resource for which we need a MatchResource.- Returns:
- The MatchResource corresponding to the given
resource.
-
getRelatedModelElement
Provide the model element the given diff applies to.- Parameters:
rac- The change- Returns:
- The model element of the given diff, or null if it cannot be found.
-
getValue
Provide the non-null model element the given diff applies to.- Parameters:
rac- The change- Returns:
- The model element of the given diff, cannot be null.
-
isContainmentDelete
This predicate will betruefor any Match which represents a containment deletion.- Returns:
- A Predicate that will be met by containment deletions.
-
getFeatureFilter
Returns the feature filter attached to the given comparison if any.- Parameters:
comp- The comparison.- Returns:
- The feature filter attached to the given comparison if any.
-