State Diagrams Forward and Reverse Engineering

Estudies4you
Forward and Reverse Engineering 
To forward engineer a Statechart diagram,
Forward engineering for the class MessageParser is shown as 

Class MessageParser { 
Public boolean put(char c) { 
switch (state) case waiting: 
if (c == "<") 
state = GettingToken; 
token = new StringBuffer();
 body = new StringBuffer(); 
} break; 
case GettingToken : 
if (c == '>') 
state = GettingBody; 
else 
token.append(c); 
break; 
case GettingBody : 
if (c == ';') 
state = Waiting; 
else body.append(c); 
return true; 
return false; 
StringBuffer getToken(){ 
return token; 
StringBuffer getBody(){ 
return body; 
private final static int Waiting = 0; 
final static int GettingToken = 1; 
final static int GettinBody = 2;
 int state = Waiting; 
StringBuffer token. body; 
}

Forward and Reverse Engineering 
Reverse engineering a statechart diagram: 
  • May not be practically useful at all, but theoretically it is possible 
  • The tools available do not have the ability for abstraction to output meaningful state diagrams


Tags
To Top