Package org.tmatesoft.hg.internal

Examples of org.tmatesoft.hg.internal.IntSliceSeq


*/
public class DiffRangeMap extends DiffHelper.DeltaInspector<ChunkSequence<?>> {
  private final IntSliceSeq ranges;
 
  public DiffRangeMap() {
    ranges = new IntSliceSeq(5);
  }
View Full Code Here


    errorCollector.assertTrue(v.equalsTo(new byte[] { 10,9,8,7,6,5,4 }));
  }
 
  @Test
  public void testIntSliceSeq() {
    IntSliceSeq s1 = new IntSliceSeq(3, 10, 10);
    s1.add(1,2,3);
    try {
      s1.add(1,2);
      errorCollector.fail("shall accept precise number of arguments");
    } catch (IllegalArgumentException ex) {
    }
    try {
      s1.add(1,2,3,4);
      errorCollector.fail("shall accept precise number of arguments");
    } catch (IllegalArgumentException ex) {
    }
    s1.add(21,22,23);
    errorCollector.assertEquals(2, s1.size());
    s1.add(7, 8, 9);
    s1.set(1, 4, 5, 6);
    IntTuple l = s1.last();
    errorCollector.assertEquals(7, l.at(0));
    errorCollector.assertEquals(8, l.at(1));
    errorCollector.assertEquals(9, l.at(2));
    int v = 1, slice = 0;
    for (IntTuple t : s1) {
View Full Code Here

    }
    progress.done();
  }

  public void start(RevisionDescriptor rd) throws HgCallbackTargetException {
    all.put(rd.targetChangesetIndex(), current = new IntSliceSeq(3));
    revDescriptor = rd;
  }
View Full Code Here

  public void deleted(DeleteBlock block) throws HgCallbackTargetException {
  }
 
  private void copyBlock(int originChangesetIndex, int blockStart, int length) {
    IntSliceSeq origin = all.get(originChangesetIndex);
    assert origin != null; // shall visit parents before came to this child
    int originPos = 0;
    int targetBlockLen = length;
    for (IntTuple t : origin) {
      int originBlockLen = t.at(0);
View Full Code Here

    for (int i = 0; i < r.size(); i+=2) {
      System.out.printf("[%d..%d) ", r.get(i), r.get(i) + r.get(i+1));
    }
    System.out.println();
    MergeStrategy1 ms = new MergeStrategy1(bc.matches);
    IntSliceSeq mr = ms.doCombine(0, 16, 508, 514);
    for (IntTuple t : mr) {
      System.out.printf("%d:[%d..%d)  ", t.at(0), t.at(1), t.at(1) + t.at(2));
    }
    System.out.println();
    System.out.println();
View Full Code Here

      if (shallStop()) {
        return;
      }
      try {
        if (p2MergeCommon != null) {
          IntSliceSeq mergeRanges = p2MergeCommon.combineAndMarkRangesWithSource(s1From, s1To, s2From, s2To, csetOrigin, csetMergeParent);
         
          /*
           * Usecases, how it USED TO BE initially:
           * 3 lines changed to 10 lines. range of 10 lines breaks down to 2 from p2, 3 from p1, and 5 from p2.
           * We report: 2 lines changed to 2(p2), then 1 line changed with 3(p1) and 5 lines added from p2.
           *
           * 10 lines changed to 3 lines, range of 3 lines breaks down to 2 line from p1 and 1 line from p2.
           * We report: 2 lines changed to 2(p1) and 8 lines changed to 1(p2)
           *
           * NOW, lines from p2 are always reported as pure add (since we need their insertion point to be in p2, not in p1)
           * and we try to consume p1 changes as soon as we see first p1's range
           */
          int s1TotalLines = s1To - s1From, s1ConsumedLines = 0, s1Start = s1From;
         
          for (Iterator<IntTuple> it = mergeRanges.iterator(); it.hasNext();) {
            IntTuple mergeRange = it.next();
            final int rangeOrigin = mergeRange.at(0);
            final int rangeStart = mergeRange.at(1);
            final int rangeLen = mergeRange.at(2);
            final boolean lastRange = it.hasNext();
View Full Code Here

      if (shallStop()) {
        return;
      }
      try {
        if (p2MergeCommon != null) {
          IntSliceSeq mergeRanges = p2MergeCommon.combineAndMarkRangesWithSource(s1InsertPoint, s2From, s2To, csetOrigin, csetMergeParent);
          int insPoint = s1InsertPoint; // track changes to insertion point
          for (IntTuple mergeRange : mergeRanges) {
            int rangeOrigin = mergeRange.at(0);
            int rangeStart = mergeRange.at(1);
            int rangeLen = mergeRange.at(2);
View Full Code Here

    private final RangePairSeq matches;
    private final IntSliceSeq mergeRanges;

    public MergeStrategy1(RangePairSeq p2EqualToM) {
      matches = p2EqualToM;
      mergeRanges = new IntSliceSeq(3, 10, 10);
    }
View Full Code Here

    public MergeStrategy2(List<RangePairSeq> p2EqualToM, DiffRangeMap p1ToBaseRanges, DiffRangeMap baseToP2Ranges) {
      matches = p2EqualToM;
      p1ToBase = p1ToBaseRanges;
      baseToP2= baseToP2Ranges;
      mergeRanges = new IntSliceSeq(3, 10, 10);
    }
View Full Code Here

      return combineAndMarkRangesWithSource(insPoint, insPoint, start, end, source1, source2);
    }

    public IntSliceSeq combineAndMarkRangesWithSource(int start1, int end1, int start2, int end2, int source1, int source2) {
      mergeRanges.clear();
      IntSliceSeq mergedLines = new IntSliceSeq(2, end2-start2, 0);
      for (int i = start2; i < end2; i++) {
        mergedLines.add(source1, 0);
      }
      // [s1Start..s1End) // range in p1 seen as changed in m
      for (RangePair p1_b : p1ToBase.findInSource(start1, end1)) {
        // there might be few ranges in (p1-base) that overlap with (p1-m) changes
        for (RangePair b_p2 : baseToP2.findInSource(p1_b.start2(), p1_b.end2())) {
          // regions in p2 that correspond to affected regions in base
          for (int p2Line = b_p2.start2(); p2Line < b_p2.end2(); p2Line++) {
            for (RangePairSeq eq : matches) {
              if (eq.includesOriginLine(p2Line)) {
                // this line in p2 is equal to some line in merge
                int mergeLine = eq.mapLineIndex(p2Line);
                if (mergeLine >= start2 && mergeLine < end2) {
                  mergedLines.set(mergeLine - start2, source2, p2Line);
                }
              }
            }
          }
        }
View Full Code Here

TOP

Related Classes of org.tmatesoft.hg.internal.IntSliceSeq

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.