001 package aima.probability.decision.cellworld; 002 003 /** 004 * @author Ravi Mohan 005 * 006 */ 007 008 public class CellWorldPosition { 009 private int x, y; 010 011 public CellWorldPosition(int x, int y) { 012 this.x = x; 013 this.y = y; 014 } 015 016 public int getX() { 017 return x; 018 } 019 020 public int getY() { 021 return y; 022 } 023 024 @Override 025 public boolean equals(Object o) { 026 if (o == this) { 027 return true; 028 } 029 if (!(o instanceof CellWorldPosition)) { 030 return false; 031 } 032 CellWorldPosition cwp = (CellWorldPosition) o; 033 return ((this.x == cwp.x) && (this.y == cwp.y)); 034 } 035 036 @Override 037 public int hashCode() { 038 return x + 31 * y; 039 } 040 041 @Override 042 public String toString() { 043 return "< " + x + " , " + y + " > "; 044 } 045 046 }