Skip to content

Commit 858b381

Browse files
author
Neil Fraser
committed
Rename a couple of variables.
1 parent e6aa1cb commit 858b381

File tree

8 files changed

+115
-115
lines changed

8 files changed

+115
-115
lines changed

csharp/DiffMatchPatch.cs

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -662,8 +662,8 @@ protected void diff_charsToLines(ICollection<Diff> diffs,
662662
StringBuilder text;
663663
foreach (Diff diff in diffs) {
664664
text = new StringBuilder();
665-
for (int y = 0; y < diff.text.Length; y++) {
666-
text.Append(lineArray[diff.text[y]]);
665+
for (int j = 0; j < diff.text.Length; j++) {
666+
text.Append(lineArray[diff.text[j]]);
667667
}
668668
diff.text = text.ToString();
669669
}
@@ -851,7 +851,7 @@ public void diff_cleanupSemantic(List<Diff> diffs) {
851851
// Stack of indices where equalities are found.
852852
Stack<int> equalities = new Stack<int>();
853853
// Always equal to equalities[equalitiesLength-1][1]
854-
string lastequality = null;
854+
string lastEquality = null;
855855
int pointer = 0; // Index of current position.
856856
// Number of characters that changed prior to the equality.
857857
int length_insertions1 = 0;
@@ -866,7 +866,7 @@ public void diff_cleanupSemantic(List<Diff> diffs) {
866866
length_deletions1 = length_deletions2;
867867
length_insertions2 = 0;
868868
length_deletions2 = 0;
869-
lastequality = diffs[pointer].text;
869+
lastEquality = diffs[pointer].text;
870870
} else { // an insertion or deletion
871871
if (diffs[pointer].operation == Operation.INSERT) {
872872
length_insertions2 += diffs[pointer].text.Length;
@@ -875,13 +875,13 @@ public void diff_cleanupSemantic(List<Diff> diffs) {
875875
}
876876
// Eliminate an equality that is smaller or equal to the edits on both
877877
// sides of it.
878-
if (lastequality != null && (lastequality.Length
878+
if (lastEquality != null && (lastEquality.Length
879879
<= Math.Max(length_insertions1, length_deletions1))
880-
&& (lastequality.Length
880+
&& (lastEquality.Length
881881
<= Math.Max(length_insertions2, length_deletions2))) {
882882
// Duplicate record.
883883
diffs.Insert(equalities.Peek(),
884-
new Diff(Operation.DELETE, lastequality));
884+
new Diff(Operation.DELETE, lastEquality));
885885
// Change second copy to insert.
886886
diffs[equalities.Peek() + 1].operation = Operation.INSERT;
887887
// Throw away the equality we just deleted.
@@ -894,7 +894,7 @@ public void diff_cleanupSemantic(List<Diff> diffs) {
894894
length_deletions1 = 0;
895895
length_insertions2 = 0;
896896
length_deletions2 = 0;
897-
lastequality = null;
897+
lastEquality = null;
898898
changes = true;
899899
}
900900
}
@@ -1088,7 +1088,7 @@ public void diff_cleanupEfficiency(List<Diff> diffs) {
10881088
// Stack of indices where equalities are found.
10891089
Stack<int> equalities = new Stack<int>();
10901090
// Always equal to equalities[equalitiesLength-1][1]
1091-
string lastequality = string.Empty;
1091+
string lastEquality = string.Empty;
10921092
int pointer = 0; // Index of current position.
10931093
// Is there an insertion operation before the last equality.
10941094
bool pre_ins = false;
@@ -1106,11 +1106,11 @@ public void diff_cleanupEfficiency(List<Diff> diffs) {
11061106
equalities.Push(pointer);
11071107
pre_ins = post_ins;
11081108
pre_del = post_del;
1109-
lastequality = diffs[pointer].text;
1109+
lastEquality = diffs[pointer].text;
11101110
} else {
11111111
// Not a candidate, and can never become one.
11121112
equalities.Clear();
1113-
lastequality = string.Empty;
1113+
lastEquality = string.Empty;
11141114
}
11151115
post_ins = post_del = false;
11161116
} else { // An insertion or deletion.
@@ -1127,18 +1127,18 @@ public void diff_cleanupEfficiency(List<Diff> diffs) {
11271127
* <ins>A</del>X<ins>C</ins><del>D</del>
11281128
* <ins>A</ins><del>B</del>X<del>C</del>
11291129
*/
1130-
if ((lastequality.Length != 0)
1130+
if ((lastEquality.Length != 0)
11311131
&& ((pre_ins && pre_del && post_ins && post_del)
1132-
|| ((lastequality.Length < this.Diff_EditCost / 2)
1132+
|| ((lastEquality.Length < this.Diff_EditCost / 2)
11331133
&& ((pre_ins ? 1 : 0) + (pre_del ? 1 : 0) + (post_ins ? 1 : 0)
11341134
+ (post_del ? 1 : 0)) == 3))) {
11351135
// Duplicate record.
11361136
diffs.Insert(equalities.Peek(),
1137-
new Diff(Operation.DELETE, lastequality));
1137+
new Diff(Operation.DELETE, lastEquality));
11381138
// Change second copy to insert.
11391139
diffs[equalities.Peek() + 1].operation = Operation.INSERT;
11401140
equalities.Pop(); // Throw away the equality we just deleted.
1141-
lastequality = string.Empty;
1141+
lastEquality = string.Empty;
11421142
if (pre_ins && pre_del) {
11431143
// No changes made which could affect previous entry, keep going.
11441144
post_ins = post_del = true;

dart/DMPClass.dart

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -512,8 +512,8 @@ class DiffMatchPatch {
512512
void _diff_charsToLines(List<Diff> diffs, List<String> lineArray) {
513513
final text = new StringBuffer();
514514
for (Diff diff in diffs) {
515-
for (int y = 0; y < diff.text.length; y++) {
516-
text.write(lineArray[diff.text.codeUnitAt(y)]);
515+
for (int j = 0; j < diff.text.length; j++) {
516+
text.write(lineArray[diff.text.codeUnitAt(j)]);
517517
}
518518
diff.text = text.toString();
519519
text.clear();
@@ -709,7 +709,7 @@ class DiffMatchPatch {
709709
// Stack of indices where equalities are found.
710710
final equalities = <int>[];
711711
// Always equal to diffs[equalities.last()].text
712-
String lastequality = null;
712+
String lastEquality = null;
713713
int pointer = 0; // Index of current position.
714714
// Number of characters that changed prior to the equality.
715715
int length_insertions1 = 0;
@@ -725,7 +725,7 @@ class DiffMatchPatch {
725725
length_deletions1 = length_deletions2;
726726
length_insertions2 = 0;
727727
length_deletions2 = 0;
728-
lastequality = diffs[pointer].text;
728+
lastEquality = diffs[pointer].text;
729729
} else {
730730
// An insertion or deletion.
731731
if (diffs[pointer].operation == Operation.insert) {
@@ -735,14 +735,14 @@ class DiffMatchPatch {
735735
}
736736
// Eliminate an equality that is smaller or equal to the edits on both
737737
// sides of it.
738-
if (lastequality != null &&
739-
(lastequality.length <=
738+
if (lastEquality != null &&
739+
(lastEquality.length <=
740740
max(length_insertions1, length_deletions1)) &&
741-
(lastequality.length <=
741+
(lastEquality.length <=
742742
max(length_insertions2, length_deletions2))) {
743743
// Duplicate record.
744744
diffs.insert(
745-
equalities.last, new Diff(Operation.delete, lastequality));
745+
equalities.last, new Diff(Operation.delete, lastEquality));
746746
// Change second copy to insert.
747747
diffs[equalities.last + 1].operation = Operation.insert;
748748
// Throw away the equality we just deleted.
@@ -756,7 +756,7 @@ class DiffMatchPatch {
756756
length_deletions1 = 0;
757757
length_insertions2 = 0;
758758
length_deletions2 = 0;
759-
lastequality = null;
759+
lastEquality = null;
760760
changes = true;
761761
}
762762
}
@@ -953,7 +953,7 @@ class DiffMatchPatch {
953953
// Stack of indices where equalities are found.
954954
final equalities = <int>[];
955955
// Always equal to diffs[equalities.last()].text
956-
String lastequality = null;
956+
String lastEquality = null;
957957
int pointer = 0; // Index of current position.
958958
// Is there an insertion operation before the last equality.
959959
bool pre_ins = false;
@@ -972,11 +972,11 @@ class DiffMatchPatch {
972972
equalities.add(pointer);
973973
pre_ins = post_ins;
974974
pre_del = post_del;
975-
lastequality = diffs[pointer].text;
975+
lastEquality = diffs[pointer].text;
976976
} else {
977977
// Not a candidate, and can never become one.
978978
equalities.clear();
979-
lastequality = null;
979+
lastEquality = null;
980980
}
981981
post_ins = post_del = false;
982982
} else {
@@ -994,21 +994,21 @@ class DiffMatchPatch {
994994
* <ins>A</del>X<ins>C</ins><del>D</del>
995995
* <ins>A</ins><del>B</del>X<del>C</del>
996996
*/
997-
if (lastequality != null &&
997+
if (lastEquality != null &&
998998
((pre_ins && pre_del && post_ins && post_del) ||
999-
((lastequality.length < Diff_EditCost / 2) &&
999+
((lastEquality.length < Diff_EditCost / 2) &&
10001000
((pre_ins ? 1 : 0) +
10011001
(pre_del ? 1 : 0) +
10021002
(post_ins ? 1 : 0) +
10031003
(post_del ? 1 : 0)) ==
10041004
3))) {
10051005
// Duplicate record.
10061006
diffs.insert(
1007-
equalities.last, new Diff(Operation.delete, lastequality));
1007+
equalities.last, new Diff(Operation.delete, lastEquality));
10081008
// Change second copy to insert.
10091009
diffs[equalities.last + 1].operation = Operation.insert;
10101010
equalities.removeLast(); // Throw away the equality we just deleted.
1011-
lastequality = null;
1011+
lastEquality = null;
10121012
if (pre_ins && pre_del) {
10131013
// No changes made which could affect previous entry, keep going.
10141014
post_ins = post_del = true;

java/src/name/fraser/neil/plaintext/diff_match_patch.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
package name.fraser.neil.plaintext;
2020

2121
import java.io.UnsupportedEncodingException;
22-
import java.net.URLEncoder;
2322
import java.net.URLDecoder;
23+
import java.net.URLEncoder;
2424
import java.util.*;
2525
import java.util.regex.Matcher;
2626
import java.util.regex.Pattern;
@@ -570,8 +570,8 @@ protected void diff_charsToLines(List<Diff> diffs,
570570
StringBuilder text;
571571
for (Diff diff : diffs) {
572572
text = new StringBuilder();
573-
for (int y = 0; y < diff.text.length(); y++) {
574-
text.append(lineArray.get(diff.text.charAt(y)));
573+
for (int j = 0; j < diff.text.length(); j++) {
574+
text.append(lineArray.get(diff.text.charAt(j)));
575575
}
576576
diff.text = text.toString();
577577
}

javascript/diff_match_patch_uncompressed.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -530,13 +530,13 @@ diff_match_patch.prototype.diff_linesToChars_ = function(text1, text2) {
530530
* @private
531531
*/
532532
diff_match_patch.prototype.diff_charsToLines_ = function(diffs, lineArray) {
533-
for (var x = 0; x < diffs.length; x++) {
534-
var chars = diffs[x][1];
533+
for (var i = 0; i < diffs.length; i++) {
534+
var chars = diffs[i][1];
535535
var text = [];
536-
for (var y = 0; y < chars.length; y++) {
537-
text[y] = lineArray[chars.charCodeAt(y)];
536+
for (var j = 0; j < chars.length; j++) {
537+
text[j] = lineArray[chars.charCodeAt(j)];
538538
}
539-
diffs[x][1] = text.join('');
539+
diffs[j][1] = text.join('');
540540
}
541541
};
542542

@@ -762,7 +762,7 @@ diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
762762
var equalities = []; // Stack of indices where equalities are found.
763763
var equalitiesLength = 0; // Keeping our own length var is faster in JS.
764764
/** @type {?string} */
765-
var lastequality = null;
765+
var lastEquality = null;
766766
// Always equal to diffs[equalities[equalitiesLength - 1]][1]
767767
var pointer = 0; // Index of current position.
768768
// Number of characters that changed prior to the equality.
@@ -778,7 +778,7 @@ diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
778778
length_deletions1 = length_deletions2;
779779
length_insertions2 = 0;
780780
length_deletions2 = 0;
781-
lastequality = diffs[pointer][1];
781+
lastEquality = diffs[pointer][1];
782782
} else { // An insertion or deletion.
783783
if (diffs[pointer][0] == DIFF_INSERT) {
784784
length_insertions2 += diffs[pointer][1].length;
@@ -787,13 +787,13 @@ diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
787787
}
788788
// Eliminate an equality that is smaller or equal to the edits on both
789789
// sides of it.
790-
if (lastequality && (lastequality.length <=
790+
if (lastEquality && (lastEquality.length <=
791791
Math.max(length_insertions1, length_deletions1)) &&
792-
(lastequality.length <= Math.max(length_insertions2,
792+
(lastEquality.length <= Math.max(length_insertions2,
793793
length_deletions2))) {
794794
// Duplicate record.
795795
diffs.splice(equalities[equalitiesLength - 1], 0,
796-
new diff_match_patch.Diff(DIFF_DELETE, lastequality));
796+
new diff_match_patch.Diff(DIFF_DELETE, lastEquality));
797797
// Change second copy to insert.
798798
diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
799799
// Throw away the equality we just deleted.
@@ -805,7 +805,7 @@ diff_match_patch.prototype.diff_cleanupSemantic = function(diffs) {
805805
length_deletions1 = 0;
806806
length_insertions2 = 0;
807807
length_deletions2 = 0;
808-
lastequality = null;
808+
lastEquality = null;
809809
changes = true;
810810
}
811811
}
@@ -1007,7 +1007,7 @@ diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
10071007
var equalities = []; // Stack of indices where equalities are found.
10081008
var equalitiesLength = 0; // Keeping our own length var is faster in JS.
10091009
/** @type {?string} */
1010-
var lastequality = null;
1010+
var lastEquality = null;
10111011
// Always equal to diffs[equalities[equalitiesLength - 1]][1]
10121012
var pointer = 0; // Index of current position.
10131013
// Is there an insertion operation before the last equality.
@@ -1026,11 +1026,11 @@ diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
10261026
equalities[equalitiesLength++] = pointer;
10271027
pre_ins = post_ins;
10281028
pre_del = post_del;
1029-
lastequality = diffs[pointer][1];
1029+
lastEquality = diffs[pointer][1];
10301030
} else {
10311031
// Not a candidate, and can never become one.
10321032
equalitiesLength = 0;
1033-
lastequality = null;
1033+
lastEquality = null;
10341034
}
10351035
post_ins = post_del = false;
10361036
} else { // An insertion or deletion.
@@ -1047,16 +1047,16 @@ diff_match_patch.prototype.diff_cleanupEfficiency = function(diffs) {
10471047
* <ins>A</del>X<ins>C</ins><del>D</del>
10481048
* <ins>A</ins><del>B</del>X<del>C</del>
10491049
*/
1050-
if (lastequality && ((pre_ins && pre_del && post_ins && post_del) ||
1051-
((lastequality.length < this.Diff_EditCost / 2) &&
1050+
if (lastEquality && ((pre_ins && pre_del && post_ins && post_del) ||
1051+
((lastEquality.length < this.Diff_EditCost / 2) &&
10521052
(pre_ins + pre_del + post_ins + post_del) == 3))) {
10531053
// Duplicate record.
10541054
diffs.splice(equalities[equalitiesLength - 1], 0,
1055-
new diff_match_patch.Diff(DIFF_DELETE, lastequality));
1055+
new diff_match_patch.Diff(DIFF_DELETE, lastEquality));
10561056
// Change second copy to insert.
10571057
diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT;
10581058
equalitiesLength--; // Throw away the equality we just deleted;
1059-
lastequality = null;
1059+
lastEquality = null;
10601060
if (pre_ins && pre_del) {
10611061
// No changes made which could affect previous entry, keep going.
10621062
post_ins = post_del = true;
@@ -2219,7 +2219,7 @@ diff_match_patch.patch_obj.prototype.toString = function() {
22192219
return text.join('').replace(/%20/g, ' ');
22202220
};
22212221

2222-
// STRIP_FOR_CLOSURE
2222+
// CLOSURE:begin_strip
22232223
// Lines below here will not be included in the Closure-compatible library.
22242224

22252225
// Export these global variables so that they survive Google's JS compiler.

0 commit comments

Comments
 (0)