Class RangeDifferencer
RangeDifferencer finds the differences between two or three
IRangeComparators.
To use the differencer, clients provide an IRangeComparator
that breaks their input data into a sequence of comparable entities. The
differencer returns the differences among these sequences as an array of
RangeDifference objects (findDifferences
methods). Every RangeDifference represents a single kind of
difference and the corresponding ranges of the underlying comparable entities
in the left, right, and optionally ancestor sides.
Alternatively, the findRanges methods not only return objects
for the differing ranges but for non-differing ranges too.
The algorithm used is an objectified version of one described in:
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic RangeDifference[]findDifferences(LCSSettings settings, IRangeComparator left, IRangeComparator right) Finds the differences between twoIRangeComparators.static RangeDifference[]findDifferences(LCSSettings settings, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) Finds the differences among threeIRangeComparators.static RangeDifference[]findDifferences(IRangeComparator left, IRangeComparator right) Finds the differences between twoIRangeComparators.static RangeDifference[]findDifferences(org.eclipse.core.runtime.IProgressMonitor pm, LCSSettings settings, IRangeComparator left, IRangeComparator right) Finds the differences between twoIRangeComparators.static RangeDifference[]findDifferences(org.eclipse.core.runtime.IProgressMonitor pm, LCSSettings settings, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) Finds the differences among threeIRangeComparators.static RangeDifference[]findRanges(LCSSettings settings, IRangeComparator left, IRangeComparator right) Finds the differences among twoIRangeComparators.static RangeDifference[]findRanges(LCSSettings settings, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) Finds the differences among threeIRangeComparators.static RangeDifference[]findRanges(org.eclipse.core.runtime.IProgressMonitor pm, LCSSettings settings, IRangeComparator left, IRangeComparator right) Finds the differences among twoIRangeComparators.static RangeDifference[]findRanges(org.eclipse.core.runtime.IProgressMonitor pm, LCSSettings settings, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) Finds the differences among threeIRangeComparators.
-
Method Details
-
findDifferences
public static RangeDifference[] findDifferences(LCSSettings settings, IRangeComparator left, IRangeComparator right) Finds the differences between twoIRangeComparators. The differences are returned as an array ofRangeDifferences. If no differences are detected an empty array is returned.- Parameters:
left- the left range comparatorright- the right range comparator- Returns:
- an array of range differences, or an empty array if no differences were found
-
findDifferences
Finds the differences between twoIRangeComparators. The differences are returned as an array ofRangeDifferences. If no differences are detected an empty array is returned.- Parameters:
left- the left range comparatorright- the right range comparator- Returns:
- an array of range differences, or an empty array if no differences were found
-
findDifferences
public static RangeDifference[] findDifferences(org.eclipse.core.runtime.IProgressMonitor pm, LCSSettings settings, IRangeComparator left, IRangeComparator right) Finds the differences between twoIRangeComparators. The differences are returned as an array ofRangeDifferences. If no differences are detected an empty array is returned.- Parameters:
pm- if notnullused to report progressleft- the left range comparatorright- the right range comparator- Returns:
- an array of range differences, or an empty array if no differences were found
- Since:
- 2.0
-
findDifferences
public static RangeDifference[] findDifferences(LCSSettings settings, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) Finds the differences among threeIRangeComparators. The differences are returned as a list ofRangeDifferences. If no differences are detected an empty list is returned. If the ancestor range comparator isnull, a two-way comparison is performed.- Parameters:
ancestor- the ancestor range comparator ornullleft- the left range comparatorright- the right range comparator- Returns:
- an array of range differences, or an empty array if no differences were found
-
findDifferences
public static RangeDifference[] findDifferences(org.eclipse.core.runtime.IProgressMonitor pm, LCSSettings settings, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) Finds the differences among threeIRangeComparators. The differences are returned as a list ofRangeDifferences. If no differences are detected an empty list is returned. If the ancestor range comparator isnull, a two-way comparison is performed.- Parameters:
pm- if notnullused to report progressancestor- the ancestor range comparator ornullleft- the left range comparatorright- the right range comparator- Returns:
- an array of range differences, or an empty array if no differences were found
- Since:
- 2.0
-
findRanges
public static RangeDifference[] findRanges(LCSSettings settings, IRangeComparator left, IRangeComparator right) Finds the differences among twoIRangeComparators. In contrast tofindDifferences, the result containsRangeDifferenceelements for non-differing ranges too.- Parameters:
left- the left range comparatorright- the right range comparator- Returns:
- an array of range differences
-
findRanges
public static RangeDifference[] findRanges(org.eclipse.core.runtime.IProgressMonitor pm, LCSSettings settings, IRangeComparator left, IRangeComparator right) Finds the differences among twoIRangeComparators. In contrast tofindDifferences, the result containsRangeDifferenceelements for non-differing ranges too.- Parameters:
pm- if notnullused to report progressleft- the left range comparatorright- the right range comparator- Returns:
- an array of range differences
- Since:
- 2.0
-
findRanges
public static RangeDifference[] findRanges(LCSSettings settings, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) Finds the differences among threeIRangeComparators. In contrast tofindDifferences, the result containsRangeDifferenceelements for non-differing ranges too. If the ancestor range comparator isnull, a two-way comparison is performed.- Parameters:
ancestor- the ancestor range comparator ornullleft- the left range comparatorright- the right range comparator- Returns:
- an array of range differences
-
findRanges
public static RangeDifference[] findRanges(org.eclipse.core.runtime.IProgressMonitor pm, LCSSettings settings, IRangeComparator ancestor, IRangeComparator left, IRangeComparator right) Finds the differences among threeIRangeComparators. In contrast tofindDifferences, the result containsRangeDifferenceelements for non-differing ranges too. If the ancestor range comparator isnull, a two-way comparison is performed.- Parameters:
pm- if notnullused to report progressancestor- the ancestor range comparator ornullleft- the left range comparatorright- the right range comparator- Returns:
- an array of range differences
- Since:
- 2.0
-