Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 83901 Details for
Bug 210688
Three-way compare shows wrong changes
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch for consideration for inclusion in 3.3.2
patch210688.txt (text/plain), 2.65 KB, created by
Michael Valenta
on 2007-11-27 16:43:40 EST
(
hide
)
Description:
Patch for consideration for inclusion in 3.3.2
Filename:
MIME Type:
Creator:
Michael Valenta
Created:
2007-11-27 16:43:40 EST
Size:
2.65 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.compare >Index: compare/org/eclipse/compare/rangedifferencer/RangeComparatorLCS.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/compare/org/eclipse/compare/rangedifferencer/RangeComparatorLCS.java,v >retrieving revision 1.4 >diff -u -r1.4 RangeComparatorLCS.java >--- compare/org/eclipse/compare/rangedifferencer/RangeComparatorLCS.java 16 Mar 2007 19:53:11 -0000 1.4 >+++ compare/org/eclipse/compare/rangedifferencer/RangeComparatorLCS.java 27 Nov 2007 21:41:34 -0000 >@@ -133,4 +133,58 @@ > subMonitor.worked(work); > } > >+ /** >+ * This method takes an LCS result interspersed with zeros (i.e. empty slots >+ * from the LCS algorithm), compacts it and shifts the LCS chunks as far towards >+ * the front as possible. This tends to produce good results most of the time. >+ * >+ * @param lcsSide A subsequence of original, presumably it is the LCS of it and >+ * some other collection of lines >+ * @param length The number of non-empty (i.e non-zero) entries in LCS >+ * @param comparator The comparator used to generate the LCS >+ */ >+ private void compactAndShiftLCS(int[] lcsSide, int length, >+ IRangeComparator comparator) { >+ // If the LCS is empty, just return >+ if (length == 0) >+ return; >+ // Skip any leading empty slots >+ int j = 0; >+ while (lcsSide[j] == 0) { >+ j++; >+ } >+ // Put the first non-empty value in position 0 >+ lcsSide[0] = lcsSide[j]; >+ j++; >+ // Push all non-empty values down into the first N slots (where N is the length) >+ for (int i = 1; i < length; i++) { >+ while (lcsSide[j] == 0) { >+ j++; >+ } >+ // Push the difference down as far as possible by comparing the line at the >+ // start of the diff with the line and the end and adjusting if they are the same >+ int nextLine = lcsSide[i - 1] + 1; >+ if (nextLine != lcsSide[j] && comparator.rangesEqual(nextLine - 1, comparator, lcsSide[j] - 1)) { >+ lcsSide[i] = nextLine; >+ } else { >+ lcsSide[i] = lcsSide[j]; >+ } >+ j++; >+ } >+ // Zero all slots after the length >+ for (int i = length; i < lcsSide.length; i++) { >+ lcsSide[i] = 0; >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.compare.internal.LCS#longestCommonSubsequence(org.eclipse.core.runtime.SubMonitor) >+ */ >+ public void longestCommonSubsequence(SubMonitor subMonitor) { >+ super.longestCommonSubsequence(subMonitor); >+ if (lcs != null) { // The LCS can be null if one of the sides is empty >+ compactAndShiftLCS(lcs[0], getLength(), comparator1); >+ compactAndShiftLCS(lcs[1], getLength(), comparator2); >+ } >+ } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 210688
:
83547
|
83590
|
83634
|
83637
| 83901