SEARCH
0-9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Prev | Current Page 65 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

"Model-Based Software Testing and Analysis with C#"


In the Controller class, the DispatchHandler method is the dispatcher that selects
which handler to run after an event occurs. It contains the core logic of the controller:
public void DispatchHandler()
{
if (ResetEnabled()) Reset();
else if (PollEnabled()) Poll();
else if (CheckMessageEnabled()) CheckMessage();
else if (ReportLostMessageEnabled()) ReportLostMessage();
else if (CalibrateEnabled()) Calibrate();
}
40 Why We Need Model-Based Analysis
The dispatcher is a collection of if statements. In the first if statement, Reset() is
the call to the handler and ResetEnabled() is the guard, a Boolean expression that
must be true when the handler is invoked. A handler whose guard is true is said to
be enabled. The design logic of the controller described in Section 3.1 is achieved
by coding the guards and the bodies of the handlers. For example, here is the guard
for the Reset handler:
bool ResetEnabled()
{
return (cevent == ControlEvent.Timeout
&& waitfor == WaitFor.Timout && sensor == Sensor.Error);
}
This guard causes the program to invoke the Reset handler when the time-out event
occurs, provided that the control program is waiting for a time-out and the sensor is
considered to be erroneous. In contrast, here is the guard for the Poll handler:
bool PollEnabled()
{
return (cevent == ControlEvent.Timeout
&& waitfor == WaitFor.Timeout && sensor == Sensor.


Pages:
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6