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 128 | Next

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

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

WaitForEvent);
}
[Action]
static void TimeoutMsgLate()
{
cevent = ControlEvent.Timeout;
TimeoutScheduled = false;
phase = Phase.HandleEvent;
// MessageRequested remains true, message will arrive later
}
static bool MessageEnabled()
{
return (MessageRequested
&& phase == Phase.WaitForEvent);
}
// This action has a parameter, must have Domain
[Action]
static void Message([Domain("Messages")] string message)
{
cevent = ControlEvent.Message;
buffer = message;
MessageRequested = false;
phase = Phase.HandleEvent;
}
static Set Messages()
{
return new Set(InRange, OutOfRange);
}
// continued ...
Figure 5.17. Reactive system: model program (part 6).
92 Model Programs
// ... Reactive system model program, continued
static bool CommandEnabled()
{
return (phase == Phase.WaitForEvent);
}
[Action]
static void Command()
{
cevent = ControlEvent.Command;
phase = Phase.HandleEvent;
}
// Helpers for enabling events
static void PollSensor() { MessageRequested = true; }
static void ResetSensor() { MessageRequested = true; }
static void StartTimer() { TimeoutScheduled = true; }
static void CancelTimer() { TimeoutScheduled = false; }
}
}
Figure 5.18. Reactive system: model program (part 7).
delivered. TimeoutMsgLate models what happens when the message is delayed; it
leaves MessageRequested == true so the message can be delivered later.


Pages:
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140
hotel jelenia góra Russian bride Free English grammar and study guid powiekszenia wielkoformatowe counter strike 1.6