1 11 package org.eclipse.jdt.internal.core; 12 13 import org.eclipse.jdt.core.ISourceRange; 14 15 18 public class SourceRange implements ISourceRange { 19 20 protected int offset, length; 21 22 public SourceRange(int offset, int length) { 23 this.offset = offset; 24 this.length = length; 25 } 26 29 public boolean equals(Object obj) { 30 if (!(obj instanceof ISourceRange)) 31 return false; 32 ISourceRange sourceRange = (ISourceRange) obj; 33 return sourceRange.getOffset() == this.offset && sourceRange.getLength() == this.length; 34 } 35 38 public int getLength() { 39 return this.length; 40 } 41 44 public int getOffset() { 45 return this.offset; 46 } 47 50 public int hashCode() { 51 return this.length ^ this.offset; 52 } 53 public String toString() { 54 StringBuffer buffer = new StringBuffer (); 55 buffer.append("[offset="); buffer.append(this.offset); 57 buffer.append(", length="); buffer.append(this.length); 59 buffer.append("]"); return buffer.toString(); 61 } 62 } 63 | Popular Tags |