T
- The type of diff for which conflict are researchedpublic abstract class AbstractConflictSearch<T extends Diff> extends Object
Modifier and Type | Field and Description |
---|---|
protected Comparison |
comparison
The comparison that contains diff.
|
protected T |
diff
The difference, never
null . |
protected ComparisonIndex |
index
The index of the comparison.
|
protected Monitor |
monitor
The monitor to report progress to.
|
Constructor and Description |
---|
AbstractConflictSearch(T diff,
ComparisonIndex index,
Monitor monitor)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
areMergeableStringAttributeChanges(Diff diff1,
Diff diff2)
Specifies whether the two given diffs,
diff1 and diff2 , are both attribute changes of String attributes and can be merged with a line-based three-way merge. |
protected void |
conflict(Diff other,
ConflictKind kind)
This will be called whenever we detect a new conflict in order to create (or update) the actual
association.
|
abstract void |
detectConflicts()
Detect conflicts with
diff in its comparison. |
protected String |
getChangedValue(AttributeChange attributeChange)
Returns the changed attribute value denoted by the given
diff . |
protected EList<Diff> |
getDiffsInSameMatch()
Get the diffs in the same
Match as diff. |
protected FeatureFilter |
getFeatureFilter(Comparison comp)
Returns the feature filter attached to the given comparison if any.
|
protected MatchResource |
getMatchResource(Resource resource)
Returns the MatchResource corresponding to the given
resource . |
protected EObject |
getRelatedModelElement(ResourceAttachmentChange rac)
Provide the model element the given diff applies to.
|
protected EObject |
getValue(ResourceAttachmentChange rac)
Provide the non-null model element the given diff applies to.
|
protected Predicate<? super Match> |
isContainmentDelete()
This predicate will be
true for any Match which represents a containment deletion. |
protected boolean |
isFeatureMapChange(Diff toCheck)
Specifies whether the given
diff is a FeatureMapChange . |
protected boolean |
isFeatureMapChangeOrMergeableStringAttributeChange(Diff diff1,
Diff diff2)
Specifies whether the given
diff1 and diff2 are either feature
map changes or mergeable attribute changes of String attributes. |
protected boolean |
isMergeable(AttributeChange diff1,
AttributeChange diff2)
Specifies whether the two given attribute changes,
diff1 and diff2 , can be merged with
a line-based three-way merge. |
protected boolean |
isMergeableText(String left,
String right,
String origin)
Specifies whether the given three versions of a text
left , right , and origin
are mergeable with a line-based three-way merge. |
protected boolean |
isStringAttributeChange(Diff toCheck)
Specifies whether the given
diff is a AttributeChange of a String attribute. |
protected final Comparison comparison
protected final ComparisonIndex index
protected final Monitor monitor
public AbstractConflictSearch(T diff, ComparisonIndex index, Monitor monitor)
diff
- The diff to search conflicts with, must not be null
and have a non-null match
that belongs to a non-null comparison. It must also have a non-null DifferenceKind
and DifferenceSource
.index
- Comparison index, must not be nullmonitor
- the monitor to report progress to, must not be nullpublic abstract void detectConflicts()
diff
in its comparison. This will add or update
conflicts in diff
's comparison.protected EList<Diff> getDiffsInSameMatch()
Match
as diff.Match
as diff, including diff.protected boolean isFeatureMapChangeOrMergeableStringAttributeChange(Diff diff1, Diff diff2)
diff1
and diff2
are either feature
map changes
or mergeable attribute changes
of String attributes.diff1
- One of the diffs to check.diff2
- The other diff to check.true
if it is a FeatureMapChange
or a mergeable AttributeChange
,
false
otherwise.protected boolean isFeatureMapChange(Diff toCheck)
diff
is a FeatureMapChange
.toCheck
- The diff to check.true
if it is a FeatureMapChange
, false
otherwise.protected boolean areMergeableStringAttributeChanges(Diff diff1, Diff diff2)
diff1
and diff2
, are both attribute changes
of String attributes and can be merged with a line-based three-way merge.diff1
- One of the diffs to check.diff2
- The other diff to check.true
if the diffs are mergeable changes of a string attribute, false
otherwise.ThreeWayTextDiff
protected boolean isStringAttributeChange(Diff toCheck)
diff
is a AttributeChange
of a String attribute.toCheck
- The diff to check.true
if it is a AttributeChange
of a String attribute, false
otherwise.protected boolean isMergeable(AttributeChange diff1, AttributeChange diff2)
diff1
and diff2
, can be merged with
a line-based three-way merge.diff1
- One of the attribute changes to check.diff2
- The other attribute change to check.true
if the attribute changes are mergeable, false
otherwise.ThreeWayTextDiff
protected boolean isMergeableText(String left, String right, String origin)
left
, right
, and origin
are mergeable with a line-based three-way merge.left
- The left version.right
- The right version.origin
- The original version.true
if they are mergeable, false otherwise.protected String getChangedValue(AttributeChange attributeChange)
diff
.attributeChange
- The attribute change for which the changed value is requested.protected void conflict(Diff other, ConflictKind kind)
other
- Second of the two differences for which we detected a conflict.kind
- Kind of this conflict.protected MatchResource getMatchResource(Resource resource)
resource
.resource
- Resource for which we need a MatchResource.resource
.protected EObject getRelatedModelElement(ResourceAttachmentChange rac)
rac
- The changeprotected EObject getValue(ResourceAttachmentChange rac)
rac
- The changeprotected Predicate<? super Match> isContainmentDelete()
true
for any Match which represents a containment deletion.protected FeatureFilter getFeatureFilter(Comparison comp)
comp
- The comparison.
Copyright (c) 2006, 2015 Obeo and others. All rights reserved.