Merge branch 'htmlGUi' of http://nitta-lab-www.is.konan-u.ac.jp/gitbucket/git/nitta-lab/AlgebraicDataflowArchitectureModel into htmlGUi
commit e72e051cbee0338600ee59669d6a3d2da1d65c72
2 parents c5b77e7 + fddaa75
Sakoda2269 authored on 4 Dec
Showing 2 changed files
View
10
AlgebraicDataflowArchitectureModel/models/DataStore.model
out accounts.{id}.name(age: Int, channgeAccountsAge(newAge: Int)) = newAge
}
 
channel addTweets {
ref accounts(accounts: Map, addTweets(accounts: Map, tweetId: Str, accountId: Str, contents: Str))
in accounts(accounts: Map, addTweets(newAccounts: Map, tweetId: Str, accountId: Str, contents: Str)) = newAccounts
out tweets(tweets: Map, addTweets(accounts, tweetId, accountId, contents))
= if(contains(accounts, accountId),
= if(
contains(accounts, accountId),
insert(tweets, tweetId, {"accountId": accountId, "contents": contents}),
tweets)
tweets
)
}
 
channel changeTweetsAccountId(tweetId: Str) {
out tweets.{tweetId}.accountId(accountId: Str, changeTweetsAccountId(newAccountId: Str)) = newAccountId
View
25
AlgebraicDataflowArchitectureModel/models/SimpleUI2.model
init {
screen := {
"widgets": {
"001": {"type": "button", "text": "a", "state": 0},
"002": {"type": "textInput", "text": "", "state": 0}
},
"layout": true
}
variables := {
"a": {
"from": "001",
"to": "002"
}
}
}
 
native channel ScreenUpdate {
in screen(curSc: Json, update(curSc, nextSc)) = nextSc
native channel TextEvent(wid: Str) {
out screen.widgets.{wid}.text(curText: Str, textEvent(nextText)) = nextText
}
 
channel AddButton {
out screen.widgets(widgets: Map, addButton(wid: Str, text: Str)) = insert(widgets, wid, {"type": "button", "text": text, "state": 0})
}
 
channel AddTextInput {
out screen.widgets(widgets: Map, addTextInput(wid: Str)) = insert(widgets, wid, {"type": "textInput", "text": "", "state": 0})
}
 
channel ChangeText(wid: Str) {
ref variables.a.from(from, updateText(from, to, newText))
ref variables.a.to(to, updateText(from, to, nexText))
in screen.widgets.{wid}.text(curText: Str, updateText(from, to, nexText)) = curText
out screen.widgets.{to}.text(curText: Str, updateText(from, to, nexText)) = if(wid == from, nextText, curText)
}