#include <rule.hpp>
Collaboration diagram for Rule:
Public Member Functions | |
Rule (int width, int height) | |
Constructor. | |
virtual | ~Rule () |
Destructor. | |
bool | operator== (Rule rule) |
Compares two rules. | |
bool | cellChanged (int x, int y, int status, GridType layout) |
Changes the status of a cell to status. | |
Grid | getInitialGrid () |
Member accessor. | |
void | setInitialGrid (Grid newGrid) |
Sets the grid for the rule initial configuration. | |
Grid | getFinalGrid () |
Member accessor. | |
void | setFinalGrid (Grid newGrid) |
Sets the grid for the rule final configuration. | |
bool | cellChanged (int x, int y, GridType layout) |
Cell status change. | |
int | getWidth () |
Member accessor. | |
int | getHeight () |
Member accessor. | |
bool | equals (Rule *rule) |
Tests two rules for equality. | |
bool | sameInitialFinal () |
Compares the initial and final configurations of a rule. | |
bool | valid () |
Checks if a rule is valid. | |
void | print () |
matrix | getInitialMatrix () |
Member accessor. | |
matrix | getFinalMatrix () |
Member accessor. | |
Private Attributes | |
int | width |
Rule width. | |
int | height |
Rule height. | |
Grid | initialGrid |
Rule initial configuration. | |
Grid | finalGrid |
Rule final configuration. |
This is a class representing a rule.
Definition at line 46 of file rule.hpp.
|
Constructor.
|
|
Destructor.
|
|
Cell status change. This is called from the manager when a cell recieves a change status signal We must know the current status and try to set the new one. Cell status changes are "Don't care" -> "Enabled" -> "Disabled"
Definition at line 97 of file rule.cpp. References finalGrid, initialGrid, nDISABLED, nDONTCARE, nENABLED, nFINAL, and nINITIAL. |
|
Changes the status of a cell to status.
Definition at line 169 of file rule.cpp. References finalGrid, initialGrid, nFINAL, and nINITIAL. Referenced by RuleDiskManager::readRule(). |
|
Tests two rules for equality.
Definition at line 197 of file rule.cpp. References getHeight(), and getWidth(). Here is the call graph for this function: ![]() |
|
Member accessor.
Definition at line 81 of file rule.cpp. References finalGrid. Referenced by Simulation::applyRule(), operator==(), and RuleDiskManager::saveRule(). |
|
Member accessor.
Definition at line 276 of file rule.cpp. References finalGrid, and Grid::getCells(). Here is the call graph for this function: ![]() |
|
Member accessor.
Definition at line 61 of file rule.cpp. References height. Referenced by Simulation::applyRule(), equals(), operator==(), sameInitialFinal(), RuleDiskManager::saveRule(), and valid(). |
|
Member accessor.
Definition at line 71 of file rule.cpp. References initialGrid. Referenced by Simulation::applyRule(), operator==(), and RuleDiskManager::saveRule(). |
|
Member accessor.
Definition at line 266 of file rule.cpp. References Grid::getCells(), and initialGrid. Here is the call graph for this function: ![]() |
|
Member accessor.
Definition at line 51 of file rule.cpp. References width. Referenced by Simulation::applyRule(), equals(), operator==(), SimulationManager::printRule(), Simulation::printRule(), Simulation::ruleApplicable(), sameInitialFinal(), RuleDiskManager::saveRule(), and valid(). |
|
Compares two rules.
Definition at line 288 of file rule.cpp. References finalGrid, getFinalGrid(), getHeight(), getInitialGrid(), getWidth(), and initialGrid. Here is the call graph for this function: ![]() |
|
|
|
Compares the initial and final configurations of a rule.
Definition at line 223 of file rule.cpp. References finalGrid, getHeight(), getWidth(), and initialGrid. Here is the call graph for this function: ![]() |
|
Sets the grid for the rule final configuration.
Definition at line 155 of file rule.cpp. References finalGrid, and Grid::init(). Here is the call graph for this function: ![]() |
|
Sets the grid for the rule initial configuration.
Definition at line 145 of file rule.cpp. References Grid::init(), and initialGrid. Here is the call graph for this function: ![]() |
|
Checks if a rule is valid.
Definition at line 246 of file rule.cpp. References finalGrid, getHeight(), getWidth(), initialGrid, nDISABLED, nDONTCARE, and nENABLED. Here is the call graph for this function: ![]() |
|
Rule final configuration.
Definition at line 75 of file rule.hpp. Referenced by cellChanged(), getFinalGrid(), getFinalMatrix(), operator==(), sameInitialFinal(), setFinalGrid(), and valid(). |
|
Rule height.
Definition at line 71 of file rule.hpp. Referenced by getHeight(). |
|
Rule initial configuration.
Definition at line 73 of file rule.hpp. Referenced by cellChanged(), getInitialGrid(), getInitialMatrix(), operator==(), sameInitialFinal(), setInitialGrid(), and valid(). |
|
Rule width.
Definition at line 69 of file rule.hpp. Referenced by getWidth(). |