1 8 13 package jfun.parsec; 14 15 21 public final class Pos implements java.io.Serializable { 22 private final int lno; 23 private final int cno; 24 25 30 public Pos(final int lno, final int cno) { 31 super(); 32 this.lno = lno; 33 this.cno = cno; 34 } 35 36 40 public int getColumnNo() { 41 return cno; 42 } 43 47 public int getLineNo() { 48 return lno; 49 } 50 51 public boolean equals(Object obj) { 52 if(obj instanceof Pos){ 53 final Pos other = (Pos)obj; 54 return lno == other.lno && cno==other.cno; 55 } 56 else return false; 57 } 58 59 public int hashCode() { 60 return lno*31+cno; 61 } 62 63 public String toString() { 64 return "line " + lno + " column "+cno; 65 } 66 67 } 68 | Popular Tags |