public final class MatchUtil extends Object
Modifier and Type | Method and Description |
---|---|
static int |
computeIndex(Match match,
EStructuralFeature feature,
Object value,
DifferenceSource side)
Compute the index of an object in the list of elements of a given match+feature on a given side.
|
static boolean |
featureContains(EObject eObject,
EStructuralFeature feature,
Object value)
Determines whether the given feature of the given
EObject contains the provided value, while
correctly handling proxies (in other words, in case of proxies, the proxy URI is compared instead of
the objects, which would otherwise lead to false negatives). |
static Iterable<Diff> |
findAddOrDeleteContainmentDiffs(Match match)
Get the potential ReferenceChanges that represent add/delete containment differences in the parent
Match of the given Match.
|
static EObject |
getContainer(Comparison comparison,
Diff difference)
Get the business model object containing the given
difference . |
static EObject |
getMatchedObject(Match m,
DifferenceSource side)
Get the object matched by a Match on a given side.
|
static EObject |
getOriginContainer(Comparison comparison,
Diff difference)
Get the business model object containing the given
difference in the origin side. |
static EObject |
getOriginObject(Comparison comparison,
EObject object)
Get the object which is the origin value from the given matching
object . |
static EObject |
getOriginValue(Comparison comparison,
ReferenceChange difference)
From a given mono-valued reference change, get the origin value.
|
static EStructuralFeature |
getStructuralFeature(Diff input)
Get the structural feature of any difference.
|
static Object |
getValue(Diff input)
Get the value of any difference.
|
static boolean |
hasDeleteDiff(Match match,
EStructuralFeature feature,
Object value)
Checks whether the given
value has been deleted from the given feature of match
. |
static boolean |
hasDiff(Match match,
EStructuralFeature feature,
Object value)
Checks whether the given
match presents a difference of any kind on the given feature 's
value . |
static boolean |
matchingIndices(Match match,
EStructuralFeature feature,
Object value1,
Object value2)
This will be used whenever we check for conflictual MOVEs in order to determine whether we have a
pseudo conflict or a real conflict.
|
public static EObject getOriginObject(Comparison comparison, EObject object)
object
.comparison
- The comparison.object
- The given object.public static boolean matchingIndices(Match match, EStructuralFeature feature, Object value1, Object value2)
Namely, this will retrieve the value of the given feature
on the right and left sides of the
given match
, then check whether the two given values are on the same index.
Note that no sanity checks will be made on either the match's sides or the feature.
match
- Match for which we need to check a feature.feature
- The feature which values we need to check.value1
- First of the two values which index we are to compare.value2
- Second of the two values which index we are to compare.true
if the two given values are located at the same index in the given feature's
values list, false
otherwise.public static int computeIndex(Match match, EStructuralFeature feature, Object value, DifferenceSource side)
match
- The matchfeature
- The structural featurevalue
- The object the index of which must be computedside
- The side on which to compute the indexpublic static boolean hasDeleteDiff(Match match, EStructuralFeature feature, Object value)
value
has been deleted from the given feature
of match
.match
- The match which differences we'll check.feature
- The feature on which we expect a difference.value
- The value we expect to have been removed from feature
.true
if there is such a Diff on match
, false
otherwise.public static boolean hasDiff(Match match, EStructuralFeature feature, Object value)
match
presents a difference of any kind on the given feature
's
value
.match
- The match which differences we'll check.feature
- The feature on which we expect a difference.value
- The value we expect to have changed inside feature
.true
if there is such a Diff on match
, false
otherwise.public static EObject getOriginValue(Comparison comparison, ReferenceChange difference)
comparison
- The comparison.difference
- The given reference change.public static EObject getOriginContainer(Comparison comparison, Diff difference)
difference
in the origin side.comparison
- The comparison.difference
- The difference.public static EObject getContainer(Comparison comparison, Diff difference)
difference
.comparison
- The comparison.difference
- The difference.public static boolean featureContains(EObject eObject, EStructuralFeature feature, Object value)
EObject
contains the provided value, while
correctly handling proxies (in other words, in case of proxies, the proxy URI is compared instead of
the objects, which would otherwise lead to false negatives).eObject
- The object of which a feature is to be checkedfeature
- The feature of which containment is to be checkedvalue
- The value which is to be verified in the featuretrue
if the feature contains the given valuepublic static Object getValue(Diff input)
input
- The difference.public static EStructuralFeature getStructuralFeature(Diff input)
input
- The difference.public static EObject getMatchedObject(Match m, DifferenceSource side)
m
- The match, must not be null
side
- The side for which we want the matched value, use null
for ORIGIN.public static Iterable<Diff> findAddOrDeleteContainmentDiffs(Match match)
match
- the given Match.null
otherwise.
Copyright (c) 2006, 2015 Obeo and others. All rights reserved.