The Systemclassis collecting all the different parts of the system together.
\begin{vdm_al} classSystem
values
c1 : Card = newCard(123456,1,1);
c2 : Card = newCard(123457,2,2);
c3 : Card = newCard(123458,3,3);
c4 : Card = newCard(123459,4,4);
c5 : Card = newCard(123460,5,5);
c6 : Card = newCard(123461,6,5);
c7 : Card = newCard(123462,7,5);
cards : setofCard = {c1,c2,c3,c4,c5,c6,c7};
resource : CentralResource = new CentralResource();
tills : map TillId to Till =
{1 |-> new Till(resource),
2 |-> new Till(resource),
3 |-> new Till(resource)};
instancevariables
clock : Clock := new Clock();
letterbox : Letterbox := new Letterbox();
types
public TillId = nat;
operations
public GetTill: TillId ==> Till
GetTill(tid) == return tills(tid);
public GetResource: () ==> CentralResource
GetResource() == return resource;
publicSystem: () ==> System System() ==
(clock.SetDate("150999"); let peter = new Cardholder().Create("Peter Gorm Larsen", "Granvej 24"),
paul = new Cardholder().Create("Paul Mukherjee", "Rugaardsvej 47"),
sten = new Cardholder().Create("Sten Agerholm", "Teisensvej ??"),
kim = new Cardholder().Create("Kim Sunesen", "??"),
CSK = new Cardholder().Create("CSK","Forskerparken 10A") in let pglacc1 = new Account().Create({1 |-> peter},5000),
saacc1 = new Account().Create({2 |-> sten},0),
ksacc1 = new Account().Create({3 |-> kim},9000),
pmacc1 = new Account().Create({4 |-> paul},6000),
ifacc1 = new Account().Create({5 |-> peter,
6 |-> sten,
7 |-> CSK},70000),
pglid1 = 1,
said1 = 2,
ksid1 = 3,
pmid1 = 4,
ifid1 = 5 in
(resource.AddAccount(pglid1,pglacc1);
resource.AddAccount(said1,saacc1);
resource.AddAccount(ksid1,ksacc1);
resource.AddAccount(pmid1,pmacc1);
resource.AddAccount(ifid1,ifacc1); -- tills := ; -- cards := {c1,c2,c3,c4,c5,c6,c7};
resource.AddLetterbox(clock,new Letterbox())));
traces
T1: let c inset cards in let t insetrng tills in let p inset {123456,123457,123458,123459,123460,123461,123462} in
(t.InsertCard(c);t.Validate(p);t.MakeWithdrawal(1000))
T2: let c inset cards in let t1, t2 insetrng tills in let p inset {123456,123457,123458,123459,123460,123461,123462} in
((t1.InsertCard(c);
t2.InsertCard(c);
t1.Validate(p);
t1.MakeWithdrawal(1000);
t2.MakeWithdrawal(1000))|
(t1.Validate(p);
t1.MakeWithdrawal(3000)) ) endSystem
\end{vdm_al}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.