Public Methods | |
ModN (int mod, int value=0) | |
ModN & | operator++ (int) |
ModN & | operator-- (int) |
bool | operator== (const ModN &operand) const |
operator int () const | |
bool | completed () |
Private Attributes | |
int | fMod |
int | fValue |
bool | fCompleted |
Models a "mod n set" (see e.g., John K. Truss "Discrete Mathematics for Computer Scientists", p.7)
Definition at line 23 of file LifeExercise.cpp.
|
Definition at line 30 of file LifeExercise.cpp. References fCompleted, fMod, and fValue. |
|
Simulates iterator behaviour. Is set to true if the last increment or decrement lead to wraparound.
Definition at line 74 of file LifeExercise.cpp. References fCompleted. Referenced by Life::calculate(). |
|
As a convenience so ModN can be used directly within integer algebraic expressions. There is a danger though, since comparisons might lead to confusing results e.g. Definition at line 66 of file LifeExercise.cpp. References fValue. |
|
Asserts maintenance of affiliation to the set, i.e. "wraps around" Side effect: Updates inner state of completed which is used for iteration. Definition at line 36 of file LifeExercise.cpp. References fCompleted, fMod, and fValue. |
|
Asserts maintenance of affiliation to the set, i.e. "wraps around" Side effect: Updates inner state of completed which is used for iteration. Definition at line 46 of file LifeExercise.cpp. References fCompleted, fMod, and fValue. |
|
We compare mod and the value. FIXME: Probably should throw exception if mods are not the same. Definition at line 56 of file LifeExercise.cpp. |
|
Definition at line 78 of file LifeExercise.cpp. Referenced by completed(), ModN(), operator++(), and operator--(). |
|
Definition at line 76 of file LifeExercise.cpp. Referenced by ModN(), operator++(), operator--(), and operator==(). |
|
Definition at line 77 of file LifeExercise.cpp. Referenced by ModN(), operator int(), operator++(), operator--(), and operator==(). |