Location.java |
1 /** 2 * Simple class to define an i, j position on a Grid. 3 * 4 * @see Grid 5 */ 6 public final class Location 7 { 8 /** 9 * The i, j 10 */ 11 int i, j; 12 /** 13 * Construct a new Location with the i, j position. 14 * 15 * @param i the row 16 * @param j the column 17 */ 18 public Location(int i, int j) 19 { 20 this.i = i; 21 this.j = j; 22 } 23 24 /** 25 * Returns the i of this. 26 * 27 * @return the i of this, ie the row 28 */ 29 public int getI() { return i; } 30 /** 31 * Returns the j of this. 32 * 33 * @return the j of this, ie the column 34 */ 35 public int getJ() { return j; } 36 /** 37 * Sets the i of this. 38 * 39 * @param the i of this, ie the row 40 */ 41 public void setI(int i) { this.i = i; } 42 /** 43 * Returns the j of this. 44 * 45 * @param the j of this, ie the row 46 */ 47 public void setJ(int j) { this.j = j; } 48 /** 49 * Set the i, j of this. 50 * 51 * @param i the new i of this, ie the new Row 52 * @param j the new j of this, ie the column 53 */ 54 public void setLocation(int i, int j) { this.i = i; this.j = j; } 55 /** 56 * Copies the i, j into this. 57 * 58 * @param l the Location to copy the i, j from, ie the Row, Column. 59 */ 60 public void setLocation(Location l) { this.i = l.i; this.j = l.j; } 61 62 }