All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.drools.examples.conway.Cell Maven / Gradle / Ivy

The newest version!
package org.drools.examples.conway;

/**
 * A Cell represents a single cell within a CellGrid.
 * A cell may be either live or dead. 

* * @author Jeff Brown * @see CellState * @see CellGridImpl */ public class Cell { private CellState cellState = CellState.DEAD; private int phase = Phase.DONE; private int liveNeighbors; private int col; private int row; public Cell(int col, int row) { this.col = col; this.row = row; } public int getCol() { return col; } public int getRow() { return row; } public int getPhase() { return this.phase; } public void setPhase(int phase) { this.phase = phase; } public int getLiveNeighbors() { return this.liveNeighbors; } public void setLiveNeighbors(int liveNeighbors) { this.liveNeighbors = liveNeighbors; } /** * @return this cell's current life state * @see #queueNextCellState(org.drools.examples.conway.CellState) * @see CellState */ public CellState getCellState() { return this.cellState; } /** * Sets this cells state * * @param newState * new state for this cell * @see CellState */ public void setCellState(final CellState newState) { this.cellState = newState; } public String toString() { return cellState + " col=" + this.col + " row=" + this.row + " phase '" + phase + "' liveNeighbors '" + liveNeighbors + "'"; } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy