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

Jonathan Jacky, Margus Veanes, Colin Campbell, Wolfram Schulte

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

15.
Note that all fields besides the status field in the setup response are ignored
in this model program. The setup model program does not include Cancel in the
vocabulary.
236 Compositional Modeling
namespace SP
{
enum CMD { Setup, Work }
[Feature]
public class Commands
{
static Map cmd = Map.EmptyMap;
[Action("ReqSetup(m,_)")]
static void ReqSetup(int m) {cmd = cmd.Add(m, CMD.Setup);}
static bool ReqSetupEnabled(int m) {return !cmd.ContainsKey(m);}
[Action("ResSetup(m,_,_)")]
static void ResSetup(int m) {cmd = cmd.RemoveKey(m);}
static bool ResSetupEnabled(int m)
{
return cmd.ContainsKey(m) && cmd[m] == CMD.Setup;
}
[Action("ReqWork(m,_)")]
static void ReqWork(int m) {cmd = cmd.Add(m, CMD.Work);}
static bool ReqWorkEnabled(int m) {return !cmd.ContainsKey(m);}
[Action("ResWork(m,_,_)")]
static void ResWork(int m) {cmd = cmd.RemoveKey(m);}
static bool ResWorkEnabled(int m)
{
return cmd.ContainsKey(m) && cmd[m] == CMD.Work;
}
[AcceptingStateCondition]
static bool IsAcceptingState() { return cmd.IsEmpty; }
}
}
Figure 14.12. Commands feature model program.
FSM(0, AcceptingStates(0),
Transitions(t(0,ReqSetup(3),0), t(0,ReqWork(4),0),
t(0,ResSetup(3),0), t(0,ResWork(4),0)))
Figure 14.13. A scnenario used to restrict the commands model program.
Advanced Topics 237
Map()
Map(3 -> CMD("Setup"))
ReqSetup(3, _)
Map(4 -> CMD("Work"))
ReqWork(4, _)
ResSetup(3, _, _)
Map(3 -> CMD("Setup"),4 -> CMD("Work"))
ReqWork(4, _) ResWork(4, _, _)
ReqSetup(3, _)
ResWork(4, _, _)
ResSetup(3, _, _)
Figure 14.


Pages:
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315
biuro księgowe łódź fuzje kartki Projektowanie pół golfowych Jajka Ekologiczne