Changeset 8928 in josm for trunk/src/org/openstreetmap/josm/tools/Diff.java
- Timestamp:
- 2015-10-22T14:35:57+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/tools/Diff.java
r8926 r8928 128 128 private static final int SNAKE_LIMIT = 20; 129 129 130 /** Find the midpoint of the shortest edit script for a specified 131 portion of the two files. 132 133 We scan from the beginnings of the files, and simultaneously from the ends, 134 doing a breadth-first search through the space of edit-sequence. 135 When the two searches meet, we have found the midpoint of the shortest 136 edit sequence. 137 138 The value returned is the number of the diagonal on which the midpoint lies. 139 The diagonal number equals the number of inserted lines minus the number 140 of deleted lines (counting only lines before the midpoint). 141 The edit cost is stored into COST; this is the total number of 142 lines inserted or deleted (counting only lines before the midpoint). 143 144 This function assumes that the first lines of the specified portions 145 of the two files do not match, and likewise that the last lines do not 146 match. The caller must trim matching lines from the beginning and end 147 of the portions it is going to specify. 148 149 Note that if we return the "wrong" diagonal value, or if 150 the value of bdiag at that diagonal is "wrong", 151 the worst this can do is cause suboptimal diff output. 152 It cannot cause incorrect diff output. */ 153 130 /** 131 * Find the midpoint of the shortest edit script for a specified 132 * portion of the two files. 133 * 134 * We scan from the beginnings of the files, and simultaneously from the ends, 135 * doing a breadth-first search through the space of edit-sequence. 136 * When the two searches meet, we have found the midpoint of the shortest 137 * edit sequence. 138 * 139 * The value returned is the number of the diagonal on which the midpoint lies. 140 * The diagonal number equals the number of inserted lines minus the number 141 * of deleted lines (counting only lines before the midpoint). 142 * The edit cost is stored into COST; this is the total number of 143 * lines inserted or deleted (counting only lines before the midpoint). 144 * 145 * This function assumes that the first lines of the specified portions 146 * of the two files do not match, and likewise that the last lines do not 147 * match. The caller must trim matching lines from the beginning and end 148 * of the portions it is going to specify. 149 * 150 * Note that if we return the "wrong" diagonal value, or if 151 * the value of bdiag at that diagonal is "wrong", 152 * the worst this can do is cause suboptimal diff output. 153 * It cannot cause incorrect diff output. 154 */ 154 155 private int diag(int xoff, int xlim, int yoff, int ylim) { 155 156 final int[] fd = fdiag; // Give the compiler a chance. … … 476 477 reverseScript = new ReverseScript(); 477 478 478 /** Report the differences of two files. DEPTH is the current directory 479 depth. */ 479 /** Report the differences of two files. DEPTH is the current directory depth. */ 480 480 public final Change diff_2(final boolean reverse) { 481 481 return diff(reverse ? reverseScript : forwardScript);
Note:
See TracChangeset
for help on using the changeset viewer.