How to model endless-loop with states in UML-state-diagram
-
Dear readers, I have a endless loop, which has internal state. How can this be modelled with UML-State-Diagram?
static int state = 0;
void mySstateTest(void)
{
for(;;) {
DoSomeImportantAction();if ( 0 == state ) { if ( 1 == ReadSomeData() ) { state = 1; } } if ( 1 == state) { if ( 0 == ReadSomeData() ) { state = 0; } } }
}
Is there a better place for asking this question Thank you
-
Dear readers, I have a endless loop, which has internal state. How can this be modelled with UML-State-Diagram?
static int state = 0;
void mySstateTest(void)
{
for(;;) {
DoSomeImportantAction();if ( 0 == state ) { if ( 1 == ReadSomeData() ) { state = 1; } } if ( 1 == state) { if ( 0 == ReadSomeData() ) { state = 0; } } }
}
Is there a better place for asking this question Thank you
-
Dear readers, I have a endless loop, which has internal state. How can this be modelled with UML-State-Diagram?
static int state = 0;
void mySstateTest(void)
{
for(;;) {
DoSomeImportantAction();if ( 0 == state ) { if ( 1 == ReadSomeData() ) { state = 1; } } if ( 1 == state) { if ( 0 == ReadSomeData() ) { state = 0; } } }
}
Is there a better place for asking this question Thank you
-
Dear readers, I have a endless loop, which has internal state. How can this be modelled with UML-State-Diagram?
static int state = 0;
void mySstateTest(void)
{
for(;;) {
DoSomeImportantAction();if ( 0 == state ) { if ( 1 == ReadSomeData() ) { state = 1; } } if ( 1 == state) { if ( 0 == ReadSomeData() ) { state = 0; } } }
}
Is there a better place for asking this question Thank you
A bit hard without the ability to embed an image, but I'll try:
/*********\
* *
* state 0 *
* *
\*********/
| ^ ^
| | |
v no| |yes
/ \ | |
/ \ | |
R==1?>-+ |
\ / ^
\ / / \
V / \
| <R==0?>-+
| \ / |
|yes \ / no|
| V |
| ^ |
| | |
v | |
/*********\ |
* * |
* state 1 *<--+
* *
\*********/Ok, the readability suffers a bit - sorry for the bleeding eyes ;)
GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)