1 11 package org.eclipse.jface.internal.text.revisions; 12 13 import org.eclipse.core.runtime.Assert; 14 15 21 public final class Hunk { 22 27 public final int line; 28 32 public final int delta; 33 34 public final int changed; 35 36 43 public Hunk(int line, int delta, int changed) { 44 Assert.isLegal(line >= 0); 45 Assert.isLegal(changed >= 0); 46 this.line= line; 47 this.delta= delta; 48 this.changed= changed; 49 } 50 51 54 public String toString() { 55 return "Hunk [" + line + ">" + changed + (delta < 0 ? "-" : "+") + Math.abs(delta) + "]"; } 57 58 61 public int hashCode() { 62 final int prime= 31; 63 int result= 1; 64 result= prime * result + changed; 65 result= prime * result + delta; 66 result= prime * result + line; 67 return result; 68 } 69 70 73 public boolean equals(Object obj) { 74 if (obj == this) 75 return true; 76 if (obj instanceof Hunk) { 77 Hunk other= (Hunk) obj; 78 return other.line == this.line && other.delta == this.delta && other.changed == this.changed; 79 } 80 return false; 81 } 82 } | Popular Tags |