Package org.exoplatform.services.document.diff

Examples of org.exoplatform.services.document.diff.Revision


      DiffService diffService = new DiffServiceImpl(getAlgo());
      for (int seed = 0; seed < 10; seed++)
      {
         Object[] random = ((DiffServiceImpl)diffService).randomEdit(orig, seed);
         Revision revision = diffService.diff(orig, random);
         Object[] patched = revision.patch(orig);
         if (!diffService.compare(patched, random))
         {
            fail("iter " + seed + " revisions differ after patch");
         }
         orig = random;
View Full Code Here


      DiffService diffService = new DiffServiceImpl(getAlgo());
      Object[] orig = ((DiffServiceImpl)diffService).randomSequence(LARGE);
      for (int seed = 0; seed < 3; seed++)
      {
         Object[] rev = ((DiffServiceImpl)diffService).shuffle(orig);
         Revision revision = diffService.diff(orig, rev);
         Object[] patched = revision.patch(orig);
         if (!diffService.compare(patched, rev))
         {
            fail("iter " + seed + " revisions differ after patch");
         }
         orig = rev;
View Full Code Here

      DiffService diffService = new DiffServiceImpl(getAlgo());
      Object[] orig = ((DiffServiceImpl)diffService).randomSequence(LARGE);
      for (int seed = 0; seed < 3; seed++)
      {
         Object[] rev = ((DiffServiceImpl)diffService).randomEdit(orig, seed);
         Revision revision = diffService.diff(orig, rev);
         Object[] patched = revision.patch(orig);
         if (!diffService.compare(patched, rev))
         {
            fail("iter " + seed + " revisions differ after patch");
         }
      }
View Full Code Here

   public void testLargeAllEdited() throws Exception
   {
      DiffService diffService = new DiffServiceImpl(getAlgo());
      Object[] orig = ((DiffServiceImpl)diffService).randomSequence(LARGE);
      Object[] rev = ((DiffServiceImpl)diffService).editAll(orig);
      Revision revision = diffService.diff(orig, rev);
      Object[] patched = revision.patch(orig);
      if (!diffService.compare(patched, rev))
      {
         fail("revisions differ after patch");
      }
View Full Code Here

      // and to label each item in orig and new with that hash value
      // or a marker that the item is not common to both.

      eqs = null; // let gc know we're done with this

      Revision deltas = new RevisionImpl(); // !!! new Revision()
      int i = 0;
      int j = 0;

      // skip matching
      // skip leading items that are equal
      // could be written
      // for (i=0; indx[i] != EOS && indx[i] == jndx[i]; i++);
      // j = i;
      for (; indx[i] != EOS && indx[i] == jndx[j]; i++, j++)
      {
         /* void */
      }

      while (indx[i] != jndx[j])
      { // only equal if both == EOS
         // they are different
         int ia = i;
         int ja = j;

         // size of this delta
         do
         {
            // look down rev for a match
            // stop at a match
            // or if the FO(rev[j]) > FO(orig[i])
            // or at the end
            while (jndx[j] < 0 || jndx[j] < indx[i])
            {
               j++;
            }
            // look down orig for a match
            // stop at a match
            // or if the FO(orig[i]) > FO(rev[j])
            // or at the end
            while (indx[i] < 0 || indx[i] < jndx[j])
            {
               i++;
            }

            // this doesn't do a compare each line with each other line
            // so it won't find all matching lines
         }
         while (indx[i] != jndx[j]);

         // on exit we have a match

         // they are equal, reverse any exedent matches
         // it is possible to overshoot, so count back matching items
         while (i > ia && j > ja && indx[i - 1] == jndx[j - 1])
         {
            --i;
            --j;
         }

         deltas.addDelta(DeltaImpl.newDelta(new ChunkImpl(orig, ia, i - ia), new ChunkImpl(rev, ja, j - ja)));
         // skip matching
         for (; indx[i] != EOS && indx[i] == jndx[j]; i++, j++)
         {
            /* void */
         }
View Full Code Here

TOP

Related Classes of org.exoplatform.services.document.diff.Revision

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.