1 package jfun.yan.xml; 2 3 9 public class Location implements java.io.Serializable { 10 private final String module; 11 private final int line; 12 private final int col; 13 16 public int getColumnNo() { 17 return col; 18 } 19 22 public int getLineNo() { 23 return line; 24 } 25 28 public String getModule() { 29 return module; 30 } 31 37 public Location(String module, int line, int col) { 38 this.col = col; 39 this.line = line; 40 this.module = module; 41 } 42 public boolean equals(Object obj) { 43 if(obj instanceof Location){ 44 final Location other = (Location)obj; 45 return line==other.line && col==other.col && module.equals(other.module); 46 } 47 return false; 48 } 49 public int hashCode() { 50 return (module.hashCode()*31+line)*31+col; 51 } 52 public String toString() { 53 return module+"(line "+line+")"; 54 } 55 56 } 57 | Popular Tags |