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

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

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

Write(", compare to {0}", previous);
if (Math.Abs(data - previous) < tol) {
previous = data;
sensor = Sensor.OK;
}
else sensor = Sensor.Error; // retain old previous
Console.WriteLine(", {0}", sensor);
}
catch {
sensor = Sensor.Error;
Console.WriteLine(", Error");
}
CancelTimer(); // cancel MessageTimeout
StartTimer(PollingInterval); // wait for next time to poll
waitfor = WaitFor.Timeout;
}
bool ReportLostMessageEnabled()
{
return (cevent == ControlEvent.Timeout && waitfor == WaitFor.Message
&& sensor == Sensor.OK);
}
void ReportLostMessage()
{
Console.WriteLine(" ReportLostMessage");
// sensor = Sensor.Error; NOT! Doesn??™t change sensor
StartTimer(PollingInterval); // wait for next time to poll
waitfor = WaitFor.Timeout;
}
void PollSensor() {}
void ResetSensor() {}
void CancelTimer() { timer.Enabled = false; }
void StartTimer(int interval) {
timer.Interval = interval; timer.Enabled = true;
}
}
}
Figure 3.4. Process controller class with dispatcher and handlers (3).
38 Why We Need Model-Based Analysis
namespace ReactiveImpl
{
using System;
using System.Drawing;
using System.Windows.Forms;
public class Simulator: Form
{
Controller c;
Button btnMessageOK, btnMessageBad, btnCommand, btnExit;
public Simulator()
{
// Controller
c = new Controller();
c.timer.Interval = Controller.PollingInterval;
c.timer.Enabled = true;
c.


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