package rules; public class Cell { protected int numberOfLiveNeighbors; private CellState state; public Cell() { this.state = CellState.DEAD; } public Cell withLiveNeighbors(int numberOfLiveNeighbors) { this.numberOfLiveNeighbors = numberOfLiveNeighbors; return this; } public Cell thatIsAlive() { this.state = CellState.ALIVE; return this; } public boolean isAlive() { return (state == CellState.ALIVE); } @Override public String toString() { return "I'm " + state + " and I have " + numberOfLiveNeighbors + " live neighbors."; } }