annotate src/org/tmatesoft/hg/internal/diff/DiffRangeMap.java @ 680:58a6900f845d

Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Sun, 21 Jul 2013 17:15:34 +0200
parents
children f568330dd9c0
rev   line source
680
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
1 /*
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2013 TMate Software Ltd
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
3 *
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
6 * the Free Software Foundation; version 2 of the License.
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
7 *
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
8 * This program is distributed in the hope that it will be useful,
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
11 * GNU General Public License for more details.
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
12 *
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
13 * For information on how to redistribute this software under
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
14 * the terms of a license other than GNU General Public License
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
15 * contact TMate Software at support@hg4j.com
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
16 */
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
17 package org.tmatesoft.hg.internal.diff;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
18
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
19 import java.util.ArrayList;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
20
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
21 import org.tmatesoft.hg.internal.DiffHelper;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
22 import org.tmatesoft.hg.internal.IntSliceSeq;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
23 import org.tmatesoft.hg.internal.IntTuple;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
24 import org.tmatesoft.hg.internal.DiffHelper.ChunkSequence;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
25
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
26 /**
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
27 * Sequence of pairs of ranges (s1Start,s1End) - (s2Start, s2End)
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
28 * @author Artem Tikhomirov
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
29 * @author TMate Software Ltd.
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
30 */
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
31 public class DiffRangeMap extends DiffHelper.DeltaInspector<ChunkSequence<?>> {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
32 private final IntSliceSeq ranges;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
33
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
34 public DiffRangeMap() {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
35 ranges = new IntSliceSeq(5);
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
36 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
37
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
38 /**
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
39 * handy method to fill this map from supplied DiffHelper
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
40 * <pre>
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
41 * DiffHelper<LineSequence> pg = ...
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
42 * pg.findMatchingBlocks(p1ToBase); // doesn't compile
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
43 * DiffHelper<?> dh = pg;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
44 * dh.findMatchingBlocks(p1ToBase); // compiles ok!
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
45 * </pre>
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
46 */
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
47 public DiffRangeMap fill(DiffHelper<?> dh) {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
48 dh.findMatchingBlocks(this);
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
49 return this;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
50 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
51
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
52 @Override
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
53 protected void added(int s1InsertPoint, int s2From, int s2To) {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
54 ranges.add(s1InsertPoint, s1InsertPoint, s2From, s2To, (int)'+');
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
55 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
56 @Override
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
57 protected void changed(int s1From, int s1To, int s2From, int s2To) {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
58 ranges.add(s1From, s1To, s2From, s2To, (int)'*');
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
59 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
60 @Override
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
61 protected void deleted(int s2DeletePoint, int s1From, int s1To) {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
62 ranges.add(s1From, s1To, s2DeletePoint, s2DeletePoint, (int)'-');
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
63 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
64 @Override
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
65 protected void unchanged(int s1From, int s2From, int length) {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
66 ranges.add(s1From, s1From + length, s2From, s2From + length, (int)'=');
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
67 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
68
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
69 public Iterable<RangePair> findInSource(int sourceStart, int sourceEnd) {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
70 ArrayList<RangePair> rv = new ArrayList<RangePair>(4);
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
71 for (IntTuple t : ranges) {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
72 int srcRangeStart = t.at(0);
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
73 int srcRangeEnd = t.at(1);
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
74 if (srcRangeEnd <= sourceStart) { // srcRangeEnd exclusive
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
75 continue;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
76 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
77 if (srcRangeStart >= sourceEnd) {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
78 break;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
79 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
80 rv.add(new RangePair(srcRangeStart, srcRangeEnd, t.at(2), t.at(3)));
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
81 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
82 return rv;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
83 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
84
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
85 public Iterable<RangePair> insertions() {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
86 return rangesOfKind('+');
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
87 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
88
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
89 public Iterable<RangePair> same() {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
90 return rangesOfKind('=');
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
91 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
92
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
93 private Iterable<RangePair> rangesOfKind(int kind) {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
94 ArrayList<RangePair> rv = new ArrayList<RangePair>(4);
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
95 for (IntTuple t : ranges) {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
96 if (t.at(4) == kind) {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
97 rv.add(new RangePair(t.at(0), t.at(1), t.at(2), t.at(3)));
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
98 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
99 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
100 return rv;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
101 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
102
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
103 public static final class RangePair {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
104 private final int s1Start;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
105 private final int s1End;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
106 private final int s2Start;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
107 private final int s2End;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
108
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
109 public RangePair(int s1Start, int s1End, int s2Start, int s2End) {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
110 this.s1Start = s1Start;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
111 this.s1End = s1End;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
112 this.s2Start = s2Start;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
113 this.s2End = s2End;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
114 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
115 public int start1() {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
116 return s1Start;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
117 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
118 public int end1() {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
119 return s1End;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
120 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
121 public int length1() {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
122 return s1End - s1Start;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
123 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
124 public int start2() {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
125 return s2Start;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
126 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
127 public int end2() {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
128 return s2End;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
129 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
130 public int length2() {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
131 return s2End - s2Start;
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
132 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
133 @Override
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
134 public String toString() {
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
135 return String.format("[%d..%d)->[%d..%d)", s1Start, s1End, s2Start, s2End);
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
136 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
137 }
58a6900f845d Blame: alternative strategy to handle merge revisions: map(diff(p1->base->p2)) to understand merge intentions better
Artem Tikhomirov <tikhomirov.artem@gmail.com>
parents:
diff changeset
138 }