diff --git a/models/Observer.model b/models/Observer.model new file mode 100644 index 0000000..20a9fd7 --- /dev/null +++ b/models/Observer.model @@ -0,0 +1,35 @@ +init{ + weather := 0 + orcs := nil + hobbits := nil + logger := "not_started" +} + +channel CIO1{ + out weather(time:Int, timePasses(nil)) == mod(time + 1,2) +} + +channel CIO2{ + out orcs(o:Tuple, update(id:Int, type:Str))==tuple(id,type) + out hobbits(h:Tuple, update(id:Int, type:Str))==tuple(id,type) +} + +channel C1{ + in weather(w:Int, update(w)) == w%2 + out orcs(o2:Tuple, update(w)) == if(eq(w,fst(o2)), o2, nil) +} + +channel C2{ + in weather(w:Int, update(w)) == w%2 + out hobbits(h2:Tuple, update(w)) == if(eq(w, fst(h2)), h2, nil) +} + +channel C3{ + in orcs(o:Tuple, setLog(o)) == o + out logger(l:Str, setLog(o)) == snd(o) +} + +channel C4{ + in hobbits(h:Tuple, setLog(h))== h + out logger(l, setLog(h)) == snd(h) +}