Package org.eclipse.team.core.variants
Class ThreeWayResourceComparator
- java.lang.Object
-
- org.eclipse.team.core.variants.ThreeWayResourceComparator
-
- All Implemented Interfaces:
IResourceVariantComparator
public class ThreeWayResourceComparator extends Object implements IResourceVariantComparator
A resource comparator that uses theThreeWaySynchronizer
to compare local resources to their resource variants. The local state is determined using the local modification state and the remote state is determined by comparing the base bytes to the remote bytes obtained from the synchronizer.- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description ThreeWayResourceComparator(ThreeWaySynchronizer synchronizer)
Create a three-way resource comparator that uses theThreeWaySynchronizer
to compare a local resource to a resource variant.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
compare(IResource local, IResourceVariant remote)
Returnstrue
if the local resource matches the remote resource based on this criteria andfalse
otherwise.boolean
compare(IResourceVariant base, IResourceVariant remote)
Returnstrue
if the base resource matches the remote resource based on this criteria andfalse
otherwise.boolean
isThreeWay()
Answerstrue
if the base tree is maintained by this comparator's subscriber.
-
-
-
Constructor Detail
-
ThreeWayResourceComparator
public ThreeWayResourceComparator(ThreeWaySynchronizer synchronizer)
Create a three-way resource comparator that uses theThreeWaySynchronizer
to compare a local resource to a resource variant.- Parameters:
synchronizer
- The synchronizer to use.
-
-
Method Detail
-
compare
public boolean compare(IResource local, IResourceVariant remote)
Description copied from interface:IResourceVariantComparator
Returnstrue
if the local resource matches the remote resource based on this criteria andfalse
otherwise. Comparing should be fast and based on cached information.- Specified by:
compare
in interfaceIResourceVariantComparator
- Parameters:
local
- the local resource to be comparedremote
- the remote resources to be compared- Returns:
true
if local and remote are equal based on this criteria andfalse
otherwise.
-
compare
public boolean compare(IResourceVariant base, IResourceVariant remote)
Description copied from interface:IResourceVariantComparator
Returnstrue
if the base resource matches the remote resource based on this criteria andfalse
otherwise. Comparing should be fast and based on cached information.- Specified by:
compare
in interfaceIResourceVariantComparator
- Parameters:
base
- the base resource to be comparedremote
- the remote resources to be compared- Returns:
true
if base and remote are equal based on this criteria andfalse
otherwise.
-
isThreeWay
public boolean isThreeWay()
Description copied from interface:IResourceVariantComparator
Answerstrue
if the base tree is maintained by this comparator's subscriber. If the base tree is not considered than the subscriber can be considered as not supported three-way comparisons. Instead comparisons are made between the local and remote only without consideration for the base.- Specified by:
isThreeWay
in interfaceIResourceVariantComparator
- Returns:
- whether this comparator is three-way or two-way
-
-