diff --git a/AlgebraicDataflowArchitectureModel/models/Observer.model b/AlgebraicDataflowArchitectureModel/models/Observer.model new file mode 100644 index 0000000..2d0a90a --- /dev/null +++ b/AlgebraicDataflowArchitectureModel/models/Observer.model @@ -0,0 +1,14 @@ +channel TimePasses { + out weather(cur:Json, timePasses(nextWeather:Str)) = {"currentWeather": nextWeather, "observers": cur.observers} +} + +channel AddObserver { + out weather.observers(cur:List, addObserver(obs:Json)) = append(cur, obs) +} + +channel Notify { + in weather(cur, notify(next.currentWeather)) = next + for EachWeatherObserver(obsNo:Int) { + out weather.observers.{obsNo}(curState:Json, notify(nextWeather)) = nextWeather + } +}