package kata.gameoflife.a20170806; // Oxford: // "Establish or indicate who or what (someone or something) is." // This could also be LocateCell. // Oxford: // "Discover the exact place or position of." /** * Game of Life Kata. * Copyright (c) 2017, Peter Kofler, licensed under BSD License. */ public class LocateCell { final int x; final int y; public LocateCell(int x, int y) { this.x = x; this.y = y; } // A class with no methods. What does it do? At the moment nothing - it is a dummy. // So we do not know. @Override public int hashCode() { return 31 * x + y; } @Override public boolean equals(Object o) { if (o == null || getClass() != o.getClass()) { return false; } LocateCell that = (LocateCell) o; return this.x == that.x && this.y == that.y; } // P has two integers, internal, and it can return a list of all coordinates // around it. What does it do? It calculates the positions of the adjacent cells. // What is the verb for that? Hm. Maybe being a coordinate is a different thing, // that would support two classes. Because equals is a method. @Override public String toString() { return "[" + x + "," + y + "]"; } }