Skip to content

Commit 598dc95

Browse files
committed
classes capitalized
1 parent daf3a89 commit 598dc95

File tree

2 files changed

+74
-74
lines changed

2 files changed

+74
-74
lines changed

lib/src/diff.dart

Lines changed: 58 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@ class CandidateThing {
1010
CandidateThing chain;
1111
}
1212

13-
class commonOrDifferentThing {
13+
class CommonOrDifferentThing {
1414
List<String> common;
1515
List<String> file1;
1616
List<String> file2;
1717
}
1818

19-
class patchDescriptionThing {
20-
patchDescriptionThing() {}
19+
class PatchDescriptionThing {
20+
PatchDescriptionThing() {}
2121

22-
patchDescriptionThing.fromFile(List<String> file, int offset, int length) {
22+
PatchDescriptionThing.fromFile(List<String> file, int offset, int length) {
2323
Offset = offset;
2424
Length = length;
2525
Chunk = new List<String>.from(file.getRange(offset, offset + length).toList(
@@ -31,19 +31,19 @@ class patchDescriptionThing {
3131
List<String> Chunk;
3232
}
3333

34-
class patchResult {
35-
patchDescriptionThing file1;
36-
patchDescriptionThing file2;
34+
class PatchResult {
35+
PatchDescriptionThing file1;
36+
PatchDescriptionThing file2;
3737
}
3838

39-
class chunkReference {
39+
class ChunkReference {
4040
int offset;
4141
int length;
4242
}
4343

4444
class diffSet {
45-
chunkReference file1;
46-
chunkReference file2;
45+
ChunkReference file1;
46+
ChunkReference file2;
4747
}
4848

4949
class Side<int> extends Enum<int> implements Comparable<Side<int>> {
@@ -60,14 +60,14 @@ class Side<int> extends Enum<int> implements Comparable<Side<int>> {
6060
}
6161
}
6262

63-
class diff3Set implements Comparable<diff3Set> {
63+
class Diff3Set implements Comparable<Diff3Set> {
6464
Side side;
6565
int file1offset;
6666
int file1length;
6767
int file2offset;
6868
int file2length;
6969

70-
int compareTo(diff3Set other) {
70+
int compareTo(Diff3Set other) {
7171
if (file1offset != other.file1offset) {
7272
return file1offset.compareTo(other.file1offset);
7373
} else {
@@ -76,7 +76,7 @@ class diff3Set implements Comparable<diff3Set> {
7676
}
7777
}
7878

79-
class patch3Set {
79+
class Patch3Set {
8080
Side side;
8181
int offset;
8282
int length;
@@ -86,7 +86,7 @@ class patch3Set {
8686
int conflictRightLength;
8787
}
8888

89-
class conflictRegion {
89+
class ConflictRegion {
9090
int file1RegionStart;
9191
int file1RegionEnd;
9292
int file2RegionStart;
@@ -204,30 +204,30 @@ CandidateThing longest_common_subsequence(List<String> file1, List<String>
204204
// throw new UnimplementedError();
205205
//}
206206

207-
List<commonOrDifferentThing> diff_comm(List<String> file1, List<String> file2) {
207+
List<CommonOrDifferentThing> diff_comm(List<String> file1, List<String> file2) {
208208
// We apply the LCS to build a "comm"-style picture of the
209209
// differences between file1 and file2.
210210

211-
List<commonOrDifferentThing> result = new List<commonOrDifferentThing>();
211+
List<CommonOrDifferentThing> result = new List<CommonOrDifferentThing>();
212212

213213
int tail1 = file1.length;
214214
int tail2 = file2.length;
215215

216-
commonOrDifferentThing common = new commonOrDifferentThing();
216+
CommonOrDifferentThing common = new CommonOrDifferentThing();
217217
common.common = new List<String>();
218218

219219
void processCommon() {
220220
if (common.common.length > 0) {
221221
common.common = common.common.reversed.toList();
222222
result.add(common);
223-
common = new commonOrDifferentThing();
223+
common = new CommonOrDifferentThing();
224224
common.common = new List<String>();
225225
}
226226
}
227227

228228
for (CandidateThing candidate = longest_common_subsequence(file1, file2);
229229
candidate != null; candidate = candidate.chain) {
230-
commonOrDifferentThing different = new commonOrDifferentThing()
230+
CommonOrDifferentThing different = new CommonOrDifferentThing()
231231
..file1 = new List<String>()
232232
..file2 = new List<String>()
233233
..common = new List<String>();
@@ -257,11 +257,11 @@ List<commonOrDifferentThing> diff_comm(List<String> file1, List<String> file2) {
257257
return result.reversed.toList();
258258
}
259259

260-
List<patchResult> diff_patch(List<String> file1, List<String> file2) {
260+
List<PatchResult> diff_patch(List<String> file1, List<String> file2) {
261261
// We apply the LCD to build a JSON representation of a
262262
// diff(1)-style patch.
263263

264-
List<patchResult> result = new List<patchResult>();
264+
List<PatchResult> result = new List<PatchResult>();
265265
int tail1 = file1.length;
266266
int tail2 = file2.length;
267267

@@ -273,11 +273,11 @@ List<patchResult> diff_patch(List<String> file1, List<String> file2) {
273273
tail2 = candidate.file2index;
274274

275275
if (mismatchLength1 > 0 || mismatchLength2 > 0) {
276-
patchResult thisResult = new patchResult();
276+
PatchResult thisResult = new PatchResult();
277277
thisResult
278-
..file1 = new patchDescriptionThing.fromFile(file1,
278+
..file1 = new PatchDescriptionThing.fromFile(file1,
279279
candidate.file1index + 1, mismatchLength1)
280-
..file2 = new patchDescriptionThing.fromFile(file2,
280+
..file2 = new PatchDescriptionThing.fromFile(file2,
281281
candidate.file2index + 1, mismatchLength2);
282282

283283
result.add(thisResult);
@@ -288,20 +288,20 @@ List<patchResult> diff_patch(List<String> file1, List<String> file2) {
288288
return result.reversed.toList();
289289
}
290290

291-
List<patchResult> strip_patch(List<patchResult> patch) {
291+
List<PatchResult> strip_patch(List<PatchResult> patch) {
292292
// Takes the output of Diff.diff_patch(), and removes
293293
// information from it. It can still be used by patch(),
294294
// below, but can no longer be inverted.
295295

296-
List<patchResult> newpatch = new List<patchResult>();
296+
List<PatchResult> newpatch = new List<PatchResult>();
297297
for (int i = 0; i < patch.length; i++) {
298-
patchResult chunk = patch[i];
299-
patchResult patchResultNewPatch = new patchResult();
300-
patchResultNewPatch.file1 = new patchDescriptionThing()
298+
PatchResult chunk = patch[i];
299+
PatchResult patchResultNewPatch = new PatchResult();
300+
patchResultNewPatch.file1 = new PatchDescriptionThing()
301301
..Offset = chunk.file1.Offset
302302
..Length = chunk.file1.Length;
303303

304-
patchResultNewPatch.file2 = new patchDescriptionThing()..Chunk =
304+
patchResultNewPatch.file2 = new PatchDescriptionThing()..Chunk =
305305
chunk.file2.Chunk;
306306

307307
newpatch.add(patchResultNewPatch);
@@ -310,13 +310,13 @@ List<patchResult> strip_patch(List<patchResult> patch) {
310310
return newpatch;
311311
}
312312

313-
void invert_patch(List<patchResult> patch) {
313+
void invert_patch(List<PatchResult> patch) {
314314
// Takes the output of Diff.diff_patch(), and inverts the
315315
// sense of it, so that it can be applied to file2 to give
316316
// file1 rather than the other way around.
317317
for (int i = 0; i < patch.length; i++) {
318-
patchResult chunk = patch[i];
319-
patchDescriptionThing tmp = chunk.file1;
318+
PatchResult chunk = patch[i];
319+
PatchDescriptionThing tmp = chunk.file1;
320320
chunk.file1 = chunk.file2;
321321
chunk.file2 = tmp;
322322
}
@@ -327,7 +327,7 @@ void invert_patch(List<patchResult> patch) {
327327
//
328328
//}
329329

330-
List<String> patch(List<String> file, List<patchResult> patch) {
330+
List<String> patch(List<String> file, List<PatchResult> patch) {
331331
// Applies a patch to a file.
332332
//
333333
// Given file1 and file2, Diff.patch(file1, Diff.diff_patch(file1, file2)) should give file2.
@@ -343,7 +343,7 @@ List<String> patch(List<String> file, List<patchResult> patch) {
343343
}
344344

345345
for (int chunkIndex = 0; chunkIndex < patch.length; chunkIndex++) {
346-
patchResult chunk = patch[chunkIndex];
346+
PatchResult chunk = patch[chunkIndex];
347347
copyCommon(chunk.file1.Offset);
348348

349349
for (int lineIndex = 0; lineIndex < chunk.file2.Chunk.length; lineIndex++) {
@@ -373,10 +373,10 @@ List<String> diff_merge_keepall(List<String> file1, List<String> file2) {
373373

374374
List<String> result = new List<String>();
375375
int file1CompletedToOffset = 0;
376-
List<patchResult> diffPatches = diff_patch(file1, file2);
376+
List<PatchResult> diffPatches = diff_patch(file1, file2);
377377

378378
for (int chunkIndex = 0; chunkIndex < diffPatches.length; chunkIndex++) {
379-
patchResult chunk = diffPatches[chunkIndex];
379+
PatchResult chunk = diffPatches[chunkIndex];
380380
if (chunk.file2.Length > 0) {
381381
//copy any not-yet-copied portion of file1 to the end of this patch entry
382382
result.addAll(file1.getRange(file1CompletedToOffset, chunk.file1.Offset +
@@ -413,10 +413,10 @@ List<diffSet> diff_indices(List<String> file1, List<String> file2) {
413413
if (mismatchLength1 > 0 || mismatchLength2 > 0) {
414414
diffSet diffSetResult = new diffSet();
415415
diffSetResult
416-
..file1 = (new chunkReference()
416+
..file1 = (new ChunkReference()
417417
..offset = tail1 + 1
418418
..length = mismatchLength1)
419-
..file2 = (new chunkReference()
419+
..file2 = (new ChunkReference()
420420
..offset = tail2 + 1
421421
..length = mismatchLength2);
422422
result.add(diffSetResult);
@@ -427,8 +427,8 @@ List<diffSet> diff_indices(List<String> file1, List<String> file2) {
427427
}
428428

429429
// TODO(adam): make private
430-
void addHunk(diffSet h, Side side, List<diff3Set> hunks) {
431-
diff3Set diff3SetHunk = new diff3Set();
430+
void addHunk(diffSet h, Side side, List<Diff3Set> hunks) {
431+
Diff3Set diff3SetHunk = new Diff3Set();
432432
diff3SetHunk
433433
..side = side
434434
..file1offset = h.file1.offset
@@ -443,7 +443,7 @@ void addHunk(diffSet h, Side side, List<diff3Set> hunks) {
443443
//
444444
//}
445445

446-
List<patch3Set> diff3_merge_indices(List<String> a, List<String> o, List<String>
446+
List<Patch3Set> diff3_merge_indices(List<String> a, List<String> o, List<String>
447447
b) {
448448
// Given three files, A, O, and B, where both A and B are
449449
// independently derived from O, returns a fairly complicated
@@ -460,7 +460,7 @@ List<patch3Set> diff3_merge_indices(List<String> a, List<String> o, List<String>
460460
List<diffSet> m1 = diff_indices(o, a);
461461
List<diffSet> m2 = diff_indices(o, b);
462462

463-
List<diff3Set> hunks = new List<diff3Set>();
463+
List<Diff3Set> hunks = new List<Diff3Set>();
464464

465465
for (int i = 0; i < m1.length; i++) {
466466
addHunk(m1[i], Side.Left, hunks);
@@ -472,12 +472,12 @@ List<patch3Set> diff3_merge_indices(List<String> a, List<String> o, List<String>
472472

473473
hunks.sort();
474474

475-
List<patch3Set> result = new List<patch3Set>();
475+
List<Patch3Set> result = new List<Patch3Set>();
476476
int commonOffset = 0;
477477

478478
void copyCommon(int targetOffset) {
479479
if (targetOffset > commonOffset) {
480-
patch3Set patch3SetResult = new patch3Set();
480+
Patch3Set patch3SetResult = new Patch3Set();
481481
patch3SetResult
482482
..side = Side.Old
483483
..offset = commonOffset
@@ -488,12 +488,12 @@ List<patch3Set> diff3_merge_indices(List<String> a, List<String> o, List<String>
488488

489489
for (int hunkIndex = 0; hunkIndex < hunks.length; hunkIndex++) {
490490
int firstHunkIndex = hunkIndex;
491-
diff3Set hunk = hunks[hunkIndex];
491+
Diff3Set hunk = hunks[hunkIndex];
492492
int regionLhs = hunk.file1offset;
493493
int regionRhs = regionLhs + hunk.file1length;
494494

495495
while (hunkIndex < hunks.length - 1) {
496-
diff3Set maybeOverlapping = hunks[hunkIndex + 1];
496+
Diff3Set maybeOverlapping = hunks[hunkIndex + 1];
497497
int maybeLhs = maybeOverlapping.file1offset;
498498
if (maybeLhs > regionRhs) {
499499
break;
@@ -509,7 +509,7 @@ List<patch3Set> diff3_merge_indices(List<String> a, List<String> o, List<String>
509509
// there's no conflict here. Either a and o were the
510510
// same, or b and o were the same.
511511
if (hunk.file2length > 0) {
512-
patch3Set patch3SetResult = new patch3Set();
512+
Patch3Set patch3SetResult = new Patch3Set();
513513
patch3SetResult
514514
..side = hunk.side
515515
..offset = hunk.file2offset
@@ -523,14 +523,14 @@ List<patch3Set> diff3_merge_indices(List<String> a, List<String> o, List<String>
523523
// do the same for the right; then, correct for skew
524524
// in the regions of o that each side changed, and
525525
// report appropriate spans for the three sides.
526-
Map<Side, conflictRegion> regions = new Map<Side, conflictRegion>();
527-
regions[Side.Left] = new conflictRegion()
526+
Map<Side, ConflictRegion> regions = new Map<Side, ConflictRegion>();
527+
regions[Side.Left] = new ConflictRegion()
528528
..file1RegionStart = a.length
529529
..file1RegionEnd = -1
530530
..file2RegionStart = o.length
531531
..file2RegionEnd = -1;
532532

533-
regions[Side.Right] = new conflictRegion()
533+
regions[Side.Right] = new ConflictRegion()
534534
..file1RegionStart = b.length
535535
..file1RegionEnd = -1
536536
..file2RegionStart = o.length
@@ -539,7 +539,7 @@ List<patch3Set> diff3_merge_indices(List<String> a, List<String> o, List<String>
539539
for (int i = firstHunkIndex; i <= hunkIndex; i++) {
540540
hunk = hunks[i];
541541
Side side = hunk.side;
542-
conflictRegion r = regions[side];
542+
ConflictRegion r = regions[side];
543543
int oLhs = hunk.file1offset;
544544
int oRhs = oLhs + hunk.file1length;
545545
int abLhs = hunk.file2offset;
@@ -559,7 +559,7 @@ List<patch3Set> diff3_merge_indices(List<String> a, List<String> o, List<String>
559559
int bRhs = regions[Side.Right].file1RegionEnd + (regionRhs -
560560
regions[Side.Right].file2RegionEnd);
561561

562-
patch3Set patch3SetResult = new patch3Set();
562+
Patch3Set patch3SetResult = new Patch3Set();
563563
patch3SetResult
564564
..side = Side.Conflict
565565
..offset = aLhs
@@ -590,7 +590,7 @@ void flushOk(List<String> okLines, List<IMergeResultBlock> result) {
590590
}
591591

592592
// TODO(adam): make private
593-
bool isTrueConflict(patch3Set rec, List<String> a, List<String> b) {
593+
bool isTrueConflict(Patch3Set rec, List<String> a, List<String> b) {
594594
if (rec.length != rec.conflictRightLength) {
595595
return true;
596596
}
@@ -619,11 +619,11 @@ List<IMergeResultBlock> diff3_merge(List<String> a, List<String> o, List<String>
619619
files[Side.Old] = o;
620620
files[Side.Right] = b;
621621

622-
List<patch3Set> indices = diff3_merge_indices(a, o, b);
622+
List<Patch3Set> indices = diff3_merge_indices(a, o, b);
623623
List<String> okLines = new List<String>();
624624

625625
for (int i = 0; i < indices.length; i++) {
626-
patch3Set x = indices[i];
626+
Patch3Set x = indices[i];
627627
Side side = x.side;
628628

629629
if (side == Side.Conflict) {
@@ -671,10 +671,10 @@ Diff3DigResult diff3_dig(String ours, String base, String theirs) {
671671
if (item is MergeOKResultBlock) {
672672
lines.addAll(item.ContentLines);
673673
} else if (item is MergeConflictResultBlock) {
674-
List<commonOrDifferentThing> inners = diff_comm(item.LeftLines,
674+
List<CommonOrDifferentThing> inners = diff_comm(item.LeftLines,
675675
item.RightLines);
676676
for (int j = 0; j < inners.length; j++) {
677-
commonOrDifferentThing inner = inners[j];
677+
CommonOrDifferentThing inner = inners[j];
678678
if (inner.common.length > 0) {
679679
lines.addAll(inner.common);
680680
} else {

0 commit comments

Comments
 (0)