Package org.eclipse.compare.internal.core.patch

Examples of org.eclipse.compare.internal.core.patch.Hunk


   */
  public static IHunk createHunk(int start, String[] lines) {
    int type = getHunkType(lines);
    int oldLength = getHunkLength(lines, true);
    int newLength = getHunkLength(lines, false);
    return new Hunk(null, type, start, oldLength, start, newLength, lines);
  }
View Full Code Here


  private static void reorder(IHunk[] hunks) {
    Arrays.sort(hunks, new HunkComparator());
    int shift = 0;
    for (int i = 0; i < hunks.length; i++) {
      Hunk hunk = (Hunk) hunks[i];
      int start = hunk.getStart(false) + shift;
      hunk.setStart(start, true);
      shift += hunk.getLength(true) - hunk.getLength(false);
    }
  }
View Full Code Here

  static class HunkComparator implements Comparator {
    public int compare(Object arg0, Object arg1) {
      if ((arg0 != null && arg0 instanceof Hunk)
          && (arg1 != null && arg1 instanceof Hunk)) {
        Hunk hunk0 = (Hunk) arg0;
        Hunk hunk1 = (Hunk) arg1;
        int shift = hunk0.getStart(true) - hunk1.getStart(true);
        return shift;
      }
      return 0;
    }
View Full Code Here

TOP

Related Classes of org.eclipse.compare.internal.core.patch.Hunk

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.