public final class ComparisonUtil extends Object
| Modifier and Type | Method and Description | 
|---|---|
| static boolean | bothArePlatformResourcesAndOnlyOneExists(Resource leftResource,
                                        Resource rightResource)Checks if both resources are platform resources and only one exists. | 
| static boolean | bothResourceHaveResourceSet(Resource leftResource,
                           Resource rightResource)Checks if both resources have resource set. | 
| static Comparison | getComparison(Diff diff)Returns the comparison associated with the given diff. | 
| static Comparison | getComparison(EObject object)Returns the comparison associated with the given object. | 
| static com.google.common.base.Function<Diff,Iterable<Diff>> | getDirectSubDiffs(boolean leftToRight)When merging a  Diff, returns the first level of sub diffs of this given diff, and all
 associated diffs (seeDiffUtil#getAssociatedDiffs(Iterable, boolean, Diff)) of these sub diffs. | 
| static EObject | getExpectedSide(Match match,
               DifferenceSource source,
               boolean mergeRightToLeft)Determines the side of the given  Matchwhich represents the model state the other side will be
 changed to. | 
| static com.google.common.base.Function<Diff,Iterable<Diff>> | getSubDiffs(boolean leftToRight)When merging a  Diff, returns the sub diffs of this given diff, and all associated diffs (seeDiffUtil#getAssociatedDiffs(Iterable, boolean, Diff)) of these sub diffs. | 
| static boolean | isAddOrSetDiff(Diff difference)Checks if the given difference is either an addition or a "set" from the default value to a new
 reference. | 
| static boolean | isContainedInFeatureMap(EObject object)Determines if the given  EObjectis contained directly within a FeatureMap by checking theEAnnotations. | 
| static boolean | isDeleteOrUnsetDiff(Diff difference)Checks if the given difference is either a deletion or a "unset" to the default value. | 
| static boolean | isFeatureMapContainment(Diff diff)Checks whether the given diff corresponds to a feature map containment change. | 
| static EObject | moveElementGetExpectedContainer(Comparison comparison,
                               FeatureMapChange diff,
                               boolean rightToLeft)Get the expected target container in case of a move. | 
public static com.google.common.base.Function<Diff,Iterable<Diff>> getSubDiffs(boolean leftToRight)
Diff, returns the sub diffs of this given diff, and all associated diffs (see
 DiffUtil#getAssociatedDiffs(Iterable, boolean, Diff)) of these sub diffs.
 
 If the diff is an AttributeChange, a
 FeatureMapChange or a
 ResourceAttachmentChange , this method will return an empty iterable.
 
 If the diff is a ReferenceChange this method will return all differences contained in the match
 that contains the value of the reference change, and all associated diffs of these differences.
 
leftToRight - the direction of merge.public static com.google.common.base.Function<Diff,Iterable<Diff>> getDirectSubDiffs(boolean leftToRight)
Diff, returns the first level of sub diffs of this given diff, and all
 associated diffs (see DiffUtil#getAssociatedDiffs(Iterable, boolean, Diff)) of these sub diffs.
 
 If the diff is an AttributeChange, a
 FeatureMapChange or a
 ResourceAttachmentChange , this method will return an empty iterable.
 
 If the diff is a ReferenceChange this method will return the first level differences contained
 in the match that contains the value of the reference change, and all associated diffs of these
 differences.
 
leftToRight - the direction of merge.public static boolean isAddOrSetDiff(Diff difference)
difference - The given difference.true if this is an addition or "set" diff.public static boolean isDeleteOrUnsetDiff(Diff difference)
difference - The given difference.true if this is a deletion or "unset" diff.public static boolean isFeatureMapContainment(Diff diff)
diff - The diff to consider.true if the given diff is to be considered a containment change,
         false otherwise.public static EObject moveElementGetExpectedContainer(Comparison comparison, FeatureMapChange diff, boolean rightToLeft)
comparison - The comparison object.diff - The diff we are currently merging.rightToLeft - Whether we should move the value in the left or right side.null otherwise.public static Comparison getComparison(EObject object)
object - the object from which the comparison should be retrieved.public static Comparison getComparison(Diff diff)
diff - The diff, which must either have a match or a MatchResource container, otherwise a NPE will
            be thrown.null if there's none.public static EObject getExpectedSide(Match match, DifferenceSource source, boolean mergeRightToLeft)
Match which represents the model state the other side will be
 changed to.match - The match whose side is returned.source - The source from which side the differences are determined.mergeRightToLeft - The direction of the merge.match which represents the desired model state in regards to the
         given DifferenceSource and MergeDirection.public static boolean isContainedInFeatureMap(EObject object)
EObject is contained directly within a FeatureMap by checking the
 EAnnotations.object - The object to check.object is directly contained within a FeatureMap.public static boolean bothArePlatformResourcesAndOnlyOneExists(Resource leftResource, Resource rightResource)
leftResource - the first resource to check.rightResource - the second resource to check.public static boolean bothResourceHaveResourceSet(Resource leftResource, Resource rightResource)
leftResource - the first resource to check.rightResource - the second resource to check.
Copyright (c) 2006, 2015 Obeo and others. All rights reserved.