diff --git a/models/Accounts.model b/models/Accounts.model deleted file mode 100644 index dba68ba..0000000 --- a/models/Accounts.model +++ /dev/null @@ -1,7 +0,0 @@ -channel CIO1 { - out accounts(l:Map, signup(id:Int, name:Str)) = append(l, {"name": name}) -} - -channel CIO2(uid:Int) { - out accounts.{uid}.name(n:Str, changeName(name)) = name -} diff --git a/models/Algolike.model b/models/Algolike.model deleted file mode 100644 index 8ea8dc2..0000000 --- a/models/Algolike.model +++ /dev/null @@ -1,113 +0,0 @@ -init { - deck := nil - handsA := nil - handsB := nil - guessA := 0 - guessB := 0 -} -channel targetAInput{ - out targetA(t:Int, setTargetA(a:Int)) = a -} -channel targetBInput{ - out targetB(t:Int, setTargetB(b:Int)) = b -} -channel attackerAInput{ - out attackerA(t:Int, setAttackerA(a:Int)) = a -} -channel attackerBInput{ - out attackerB(t:Int, setAttackerB(b:Int)) = b -} -channel guessAInput{ - out guessA(t:Int, setGuessA(a:Int)) = a -} -channel guessBInput{ - out guessB(t:Int, setGuessB(b:Int)) = b -} -channel addDeck{ - out deck(d:List, addCard(num:Integer)) = cons(tuple(num, false), d) -} - -channel drawAInput{ - - ref targetA(t:Int, drawAndAttackA(t, g, b)) - ref guessA(g:Int, drawAndAttackA(t, g, b)) - ref handsB(b:List, drawAndAttackA(t, g, b)) - out resultByDrawingA(sda:Tuple, drawAndAttackA(t, g, b)) = tuple(fst(get(b, t)) == g, t) -} - -channel inputDrawArgsA{ - in resultByDrawingA(sda:Tuple, drawA(sucTrg, d)) = sucTrg - ref deck(d:List, drawA(sucTrg, d)) - - out handsA(outA:List, drawA(sucTrg, d)) = if(fst(sucTrg), - sortByKey(cons(tuple(fst(head(d)), false), outA)), - sortByKey(cons(tuple(fst(head(d)), true), outA))) - - out handsB(outB:List, drawA(sucTrg, d)) = if(fst(sucTrg), - set(outB, snd(sucTrg), tuple(fst(get(outB, snd(sucTrg))), true)), - outB) - out deck(t:List, drawA(sucTrg, d)) = tail(t) -} - -channel selectAInput{ - ref attackerA(a:Int, selectAndAttackA(a, t, g, b)) - ref targetA(t:Int, selectAndAttackA(a, t, g, b)) - ref guessA(g:Int, selectAndAttackA(a, t, g, b)) - ref handsB(b:List, selectAndAttackA(a, t, g, b)) - out resultBySelectingA(ssa:Tuple, selectAndAttackA(a, t, g, b)) = tuple(fst(get(b, t)) == g, t, a) -} -channel inputSelectArgA{ - in resultBySelectingA(ssa, selectA(sucTrgAtk)) = sucTrgAtk - out handsA(outA, selectA(sucTrgAtk)) = if(fst(sucTrgAtk), - outA, - set(outA, snd(snd(sucTrgAtk)), tuple(fst(get(outA, snd(snd(sucTrgAtk)))), true))) - out handsB(outB, selectA(sucTrgAtk)) = if(fst(sucTrgAtk), - set(outB, fst(snd(sucTrgAtk)), tuple(fst(get(outB, fst(snd(sucTrgAtk)))), true)), - outB) -} -channel drawBInput{ - ref targetB(t:Int, drawAndAttackB(t, g, a)) - ref guessB(g:Int, drawAndAttackB(t, g, a)) - ref handsA(a:List, drawAndAttackB(t, g, a)) - out resultByDrawingB(sdb:Tuple, drawAndAttackB(t, g, a)) = tuple(fst(get(a, t)) == g, t) -} - -channel inputDrawArgsB{ - in resultByDrawingB(sdb:Tuple, drawB(sucTrg, d)) = sucTrg - ref deck(d:List, drawB(sucTrg, d)) - - out handsB(outB:List, drawB(sucTrg, d)) = if(fst(sucTrg), - sortByKey(cons(tuple(fst(head(d)),false), outB)), - sortByKey(cons(tuple(fst(head(d)), true), outB))) - - out handsA(outA:List, drawB(sucTrg, d)) = if(fst(sucTrg), - set(outA, snd(sucTrg), tuple(fst(get(outA, snd(sucTrg))), true)), - outA) - out deck(t:List, drawB(sucTrg, d)) = tail(t) -} - -channel selectBInput{ - ref attackerB(atk:Int, selectAndAttackB(atk, t, g, a)) - ref targetB(t:Int, selectAndAttackB(atk, t, g, a)) - ref guessB(g:Int, selectAndAttackB(atk, t, g, a)) - ref handsA(a:List, selectAndAttackB(atk, t, g, a)) - out resultBySelectingB(ssb:Tuple, selectAndAttackB(atk, t, g, a)) = tuple(fst(get(a, t)) == g, t, atk) -} -channel inputSelectArgB{ - in resultBySelectingB(ssb, selectB(sucTrgAtk)) = sucTrgAtk - out handsB(outB, selectB(sucTrgAtk)) = if(fst(sucTrgAtk), - outB, - set(outB, snd(snd(sucTrgAtk)), tuple(fst(get(outB, snd(snd(sucTrgAtk)))), true))) - out handsA(outA, selectB(sucTrgAtk)) = if(fst(sucTrgAtk), - set(outA, fst(snd(sucTrgAtk)), tuple(fst(get(outA, fst(snd(sucTrgAtk)))), true)), - outA) -} - -channel judgeA{ - in handsA(a:List, judge(j)) = j - out loseA(la:Bool, judge(j)) = length(extractFaceDown(j)) == 0 -} -channel judgeB{ - in handsB(b:List, judge(j)) = j - out loseB(lb:Bool, judge(j)) = length(extractFaceDown(j)) == 0 -} \ No newline at end of file diff --git a/models/Base.model b/models/Base.model deleted file mode 100644 index bb460e4..0000000 --- a/models/Base.model +++ /dev/null @@ -1,13 +0,0 @@ -channel CIO{ - out r1(x1:Int, set1(y1:Int)) = y1 - out r1(x1, e) = x1 -} -channel CIO2{ - out r2(x2:Int, set2(y2:Int)) = y2 - out r2(x2, e) = x2 -} -channel C1{ - in r1(x1, update(x1:Int, y1:Int, x2:Int, y2:Int)) = y1 - in r2(x2, update(x1, y1, x2, y2)) = y2 - out r3(x3:Int, update(x1, y1, x2, y2)) = x1 + y1 + x2 + y2 -} \ No newline at end of file diff --git a/models/Clock.dtram b/models/Clock.dtram deleted file mode 100644 index bbeb6dc..0000000 --- a/models/Clock.dtram +++ /dev/null @@ -1,27 +0,0 @@ -model { -channel CIO1 { - out min(m: Int, tick) = (m + 1) % 60 -} -channel HourUpdate { - in hour(h: Int, update(h2)) = h2 - out hour_ang(h_ang: Double, update(h2)) = h2 / 6 * PI -} -channel MinUpdate { - in min(m, update(m2)) = m2 - out min_ang(m_ang: Double, update(m2)) = m2 / 30 * PI -} -channel Clock { - in min(m, update(m2)) = m2 - out hour(h, update(m2)) = if(m2 == 0, (h + 1) % 24, h) -} -} -geometry { - node c HourUpdate:520,340,30,30 - node c MinUpdate:520,100,30,30 - node c Clock:280,220,30,30 - node r min_ang:670,100,80,30 - node r min:250,100,80,30 - node r hour:270,340,80,30 - node r hour_ang:680,340,80,30 - node ioc CIO1:100,100,30,30 -} diff --git a/models/Clock.model b/models/Clock.model deleted file mode 100644 index 0ecb11b..0000000 --- a/models/Clock.model +++ /dev/null @@ -1,15 +0,0 @@ -channel CIO1 { - out min(m: Int, tick) = (m + 1) % 60 -} -channel HourUpdate { - in hour(h: Int, update(h2)) = h2 - out hour_ang(h_ang: Double, update(h2)) = h2 / 6 * PI -} -channel MinUpdate { - in min(m, update(m2)) = m2 - out min_ang(m_ang: Double, update(m2)) = m2 / 30 * PI -} -channel Clock { - in min(m, update(m2)) = m2 - out hour(h, update(m2)) = if(m2 == 0, (h + 1) % 24, h) -} diff --git a/models/CustomerOffice.model b/models/CustomerOffice.model deleted file mode 100644 index 091189a..0000000 --- a/models/CustomerOffice.model +++ /dev/null @@ -1,21 +0,0 @@ -channel CIO_AddCustomer { - out customers(db:Map, addCustomer(uid:Str, off:Str)) = insert(db, uid, {"off": off}) -} - -channel CIO_AddCampany { - out companies(db:Map, addCampany(cid:Str, add:Str)) = insert(db, cid, {"add": add}) -} - -channel CIO_SetCustomerOff(uid:Str) { - out customers.{uid}.off(cid:Str, setOff(cid2)) = cid2 -} - -channel CIO_SetCompanyAdd(cid:Str) { - out companies.{cid}.add(a1:Str, setAdd(a2)) = a2 -} - -channel C(uid:Str) { - in customers.{uid}.off(cid, sync(cid2, add2)) = cid2 - in companies.{cid2}.add(a1, sync(cid2, add2)) = add2 - out customers.{uid}.add(a3:Str, sync(cid2, add2)) = add2 -} diff --git a/models/Game.model b/models/Game.model deleted file mode 100644 index 5c1eca3..0000000 --- a/models/Game.model +++ /dev/null @@ -1,32 +0,0 @@ -channel CIO { - out force(f:Double, action(x:Double)) = x - out time(t:Double, action(x)) = t + 0.01 - out force(f, e) = x - out time(t, e) = t + 0.01 -} - -channel CIO2 { - out velocity(v:Double, setVel(x:Double)) = x - out velocity(v, e) = x -} - -channel CIO3 { - out mass(m:Double, setMass(x:Double)) = x - out mass(m, e) = m -} - -channel C1 { - in force(f, update1(y, z)) = y - in mass(m, update1(y, z)) = z - out acceleration(a: Double, update1(y, z)) = y / z -} - -channel C2 { - in acceleration(a, update2(z)) = z - out velocity(v:Double, update2(z)) = v + 0.01 * z -} - -channel C3 { - in velocity(v, update3(u)) = u - out position(p:Double, update3(u)) = p + 0.01 * u -} \ No newline at end of file diff --git a/models/InventoryManagement.model b/models/InventoryManagement.model deleted file mode 100644 index 578d56c..0000000 --- a/models/InventoryManagement.model +++ /dev/null @@ -1,7 +0,0 @@ -channel ItemRegistration { - out inventory(itemDB:Map, registerItem(itemId:Str, itemName:Str, quantity:Int)) = insert(itemDB, itemId, {"count": quantity, "name": itemName}) -} - -channel ReceivingOrShipping(itemId:Str) { - out inventory.{itemId}.count(prev_quantity:Int, receiveOrShip(quantity:Int)) = prev_quantity + quantity -} diff --git a/models/JumpGame.model b/models/JumpGame.model deleted file mode 100644 index 43b8d0c..0000000 --- a/models/JumpGame.model +++ /dev/null @@ -1,71 +0,0 @@ -init { - force := pair(0.0, 0.0) - time := 0.0 - movex := 0.0 - movey := 0.0 - mass := 1.0 - ground := true - acceleration := pair(0.0, 0.0) - velocity := pair(0.0, 0.0) - onground := true - position := pair(0.0, 0.0) - clear := false - gameover := false -} -channel CIO { - out force(f:Pair, gravity(y:Double)) = pair(0.0, y) - out time(t:Double, gravity(y)) = t + 0.01 -} -channel CIO2 { - out movex(x:Double, run(x2:Double)) = x2 -} -channel CIO3 { - out movey(y:Double, jump(y2:Double)) = y2 -} -channel CIO4 { - out mass(m:Double, setMass(x:Double)) = x -} -channel CIO5 { - out ground(g:Bool, openHole) = false - out ground(g, closeHole) = true -} -channel C1 { - ref onground(o, update1(f2, m2, o)) - in force(f, update1(f2, m2, o)) = f2 - in mass(m, update1(f2, m2, o)) = m2 - out acceleration(a:Pair, update1(f2, m2, o)) = if(o, pair(left(f2) / m2, 0.0), pair(left(f2) / m2, right(f2) / m2)) -} -channel C2 { - ref onground(o, update3(a2, o)) - in acceleration(a, update3(a2, o)) = a2 - out velocity(v:Pair, update3(a2, o)) = if(o && right(v) < 0.0, - pair(left(v) + 0.01 * left(a2), 0.0), - pair(left(v) + 0.01 * left(a2), right(v) + 0.01 * right(a2))) -} -channel C3 { - ref onground(o, update4(x2, o)) - in movex(x, update4(x2, o)) = x2 - out velocity(v:Pair, update4(x2, o)) = if(o, pair(x2, right(v)), v) -} -channel C4 { - ref onground(o, update5(x2, o)) - in movey(y, update5(y2, o)) = y2 - out velocity(v:Pair, update5(y2, o)) = if(o, pair(left(v), y2), v) -} -channel C5 { - in velocity(v, update6(v2, g)) = v2 - ref ground(g, update6(v2, g)) - out position(p:Pair, update6(v2, g)) = if(g == true && right(p) + 0.01 * right(v2) > 0.0, - pair(left(p) + 0.01 * left(v2), 0.0), - pair(left(p) + 0.01 * left(v2), right(p) + 0.01 * right(v2))) -} -channel C6 { - in position(p, update2(p2, g2)) = p2 - in ground(g, update2(p2, g2)) = g2 - out onground(o:Bool, update2(p2, g2)) = (g2 == true && right(p2) <= 0.0) -} -channel C7 { - in position(p, update7(p2)) = p2 - out clear(c:Bool, update7(p2)) = (left(p2) > 100.0) - out gameover(go:Bool, update7(p2)) = (right(p2) < -1.0) -} \ No newline at end of file diff --git a/models/Kinematics.model b/models/Kinematics.model deleted file mode 100644 index 4f4ab26..0000000 --- a/models/Kinematics.model +++ /dev/null @@ -1,20 +0,0 @@ -channel CIO { - out force(f:Double, action(x)) = x - out time(t:Double, action(x)) = t + 0.01 -} - -channel C1 { - in force(f, update1(y, m)) = y - in mass(m, update1(y, m)) = m - out acceleration(a:Double, update1(y, m)) = y / m -} - -channel C2 { - in acceleration(a, update2(z)) = z - out velocity(v:Double, update2(z)) = v + 0.01 * z -} - -channel C3 { - in velocity(v, update3(u)) = u - out position(p:Double, update3(u)) = p + 0.01 * u -} \ No newline at end of file diff --git a/models/NemophilaAccounts.model b/models/NemophilaAccounts.model deleted file mode 100644 index c2cc23a..0000000 --- a/models/NemophilaAccounts.model +++ /dev/null @@ -1,86 +0,0 @@ -channel CIO_CreateAccount { - out accounts(acList:List, createAccount(name:Str)) = append(acList, { - "name": name, - "posts": nil, - "newFriend": null, - "delReqFriend": null, - "newRequesting": null, - "friends": nil, - "requesting": nil, - "requested": nil, - }) -} - -channel CIO_ChangeName(uid:Str) { - out accounts.{uid}.name(prevName:Str, changeName(name)) = name -} - -channel CIO_CreatePost(uid:Str) { - out accounts.{uid}.posts(postsList:List, createPost(comment:Str)) = cons(comment:Str, postsList) -} - -channel CIO_DeletePost(uid:Str) { - out accounts.{uid}.posts(postsList:List, deletePost(pid:Str)) = remove(postsList, pid:Str) -} - -channel CIO_PostRequesting(sendId:Str) { - out accounts.{sendId}.newRequesting(preNewResuesting:Str, postRequesting(recvId:Str)) = recvId -} - -channel C_AddRequesting(sendId:Str) { - in accounts.{sendId}.newRequesting(preNewResuesting:Str, sync1(recvId:Str, sendRequested:Map, recvRequesting:Map, sendFriends:Map)) = recvId - ref accounts.{sendId}.friends(sendFriends:Map, sync1(recvId:Str, sendRequested:Map, recvRequesting:Map, sendFriends:Map)) - ref accounts.{sendId}.requested(sendRequested:Map, sync1(recvId:Str, sendRequested:Map, recvRequesting:Map, sendFriends:Map)) - ref accounts.{recvId}.requesting(recvRequesting:Map, sync1(recvId:Str, sendRequested:Map, recvRequesting:Map, sendFriends:Map)) - - out accounts.{sendId}.requesting(sendRequesting:Map, sync1(recvId:Str, sendRequested:Map, recvRequesting:Map, sendFriends:Map)) = if(contains(sendFriends:Map, recvId) == true, - sendRequesting, - insert(sendRequesting:Map, recvId:Str, true)) - out accounts.{recvId}.requested(recvRequested:Map, sync1(recvId:Str, sendRequested:Map, recvRequesting:Map, sendFriends:Map)) = if(ontains(sendFriends:Map, recvId) == true, - recvRequested, - insert(recvRequested:Map, sendId:Str, true)) -} - -channel CIO_RejectRequest(recvId:Str) { - out accounts.{sendId}.requesting(sendRequesting:Map, rejectRequest(sendId:Str)) = delete(sendRequesting:Map, recvId:Str) - out accounts.{recvId}.requested(recvRequested:Map, rejectRequest(sendId:Str)) = delete(recvRequested:Map, sendId:Str) -} - -channel CIO_AdmitFriend(recvId:Str) { - out accounts.{recvId}.newFriend(preNewFriend:Str, admitFriend(sendId:Str)) = sendId -} - -channel C_AddFriend(recvId:Str) { - in accounts.{recvId}.newFriend(preSendId:Str, sync2(sendId:Str, preSendTing:Map, preRecvTed:Map)) = sendId - ref accounts.{sendId}.requesting(preSendTing:Map, sync2(sendId:Str, preSendTing:Map, preRecvTed:Map)) - ref accounts.{recvId}.requested(preRecvTed:Map, sync2(sendId:Str, preSendTing:Map, preRecvTed:Map)) - - out accounts.{sendId}.friends(sendFriends:Map, sync2(sendId:Str, preSendTing:Map, preRecvTed:Map)) = if(contains(preSendTing:Map, recvId) == true && contains(preRecvTed:Map, sendId) == true, - insert(sendFriends, recvId:Str, true), - sendFriends) - out accounts.{recvId}.friends(recvFriends:Map, sync2(sendId:Str, preSendTing:Map, preRecvTed:Map)) = if(contains(preSendTing:Map, recvId) == true && contains(preRecvTed:Map, sendId) == true, - insert(recvFriends, sendId:Str, true), - recvFriends) - out accounts.{sendId}.requesting(sendRequesting:Map, sync2(sendId:Str, preSendTing:Map, preRecvTed:Map)) = if(contains(preSendTing:Map, recvId) == true && contains(preRecvTed:Map, sendId) == true, - delete(sendRequesting:Map, recvId:Str), - sendRequesting) - out accounts.{recvId}.requested(recvRequested:Map, sync2(sendId:Str, preSendTing:Map, preRecvTed:Map)) = if(contains(preSendTing:Map, recvId) == true && contains(preRecvTed:Map, sendId) == true, - delete(recvRequested:Map, sendId:Str), - recvRequested) -} - -channel CIO_DeleteFriendRequest(sendId:Str) { - out accounts.{sendId}.delReqFriend(preDelReqFriend:Str, deleteFriend(recvId:Str)) = recvId -} - -channel CIO_DeleteFriend(sendId:Str) { - in accounts.{sendId}.delReqFriend(preRecvId:Str, sync3(recvId:Str, preSendFriends:Map, preRecvFriends:Map)) = recvId - ref accounts.{sendId}.friends(preSendFriends:Map, sync3(recvId:Str, preSendFriends:Map, preRecvFriends:Map)) - ref accounts.{recvId}.friends(preRecvFriends:Map, sync3(recvId:Str, preSendFriends:Map, preRecvFriends:Map)) - out accounts.{sendId}.friends(sendFriends:Map, sync3(recvId:Str, preSendFriends:Map, preRecvFriends:Map)) = if(contains(preSendFriends:Map, recvId) == true || contains(preRecvFriends:Map, sendId) == true, - delete(sendFriends:Map, recvId:Str), - sendFriends) - out accounts.{recvId}.friends(recvFriends:Map, sync3(recvId:Str, preSendFriends:Map, preRecvFriends:Map)) = if(contains(preSendFriends:Map, recvId) == true || contains(preRecvFriends:Map, sendId) == true, - delete(recvFriends:Map, sendId:Str), - recvFriends) -} \ No newline at end of file diff --git a/models/OnlineBattleGame.model b/models/OnlineBattleGame.model deleted file mode 100644 index 846ffbf..0000000 --- a/models/OnlineBattleGame.model +++ /dev/null @@ -1,31 +0,0 @@ -channel CIO_Signup{ - out accounts(adb:Map, signUp(aid:Str, name:Str)) = insert(adb, aid, {"name": name}) -} - -channel CIO_ChangeName(aid:Str) { - out accounts.{aid}.name(prev_name:Str, changeName(name)) = name -} - -channel CIO_CreateRoom { - out rooms(rdb:Map, createRoom(rid:Str, blue_id:Str, red_id:Str)) = insert(rdb, rid, {"blue_id": blue_id, "red_id": red_id}) -} - -channel CIO_ChangeRed_id(rid:Str) { - out rooms.{rid}.red_id(prev_red_id:Str, changeRed_id(red_id)) = red_id -} - -channel CIO_ChangeBlue_id(rid:Str) { - out rooms.{rid}.blue_id(prev_blue_id:Str, changeBlue_id(blue_id)) = blue_id -} - -channel C_red(rid:Str) { - in rooms.{rid}.red_id(prev_aid:Str, sync(aid, name)) = aid - in accounts.{aid}.name(prev_name:Str, sync(aid, name)) = name - out rooms.{rid}.red_name(prev_name:Str, sync(aid, name)) = name -} - -channel C_blue(rid:Str) { - in rooms.{rid}.blue_id(prev_aid:Str, sync(aid, name)) = aid - in accounts.{aid}.name(prev_name:Str, sync(aid, name)) = name - out rooms.{rid}.blue_name(prev_name:Str, sync(aid, name)) = name -} \ No newline at end of file diff --git a/models/POS.dtram b/models/POS.dtram deleted file mode 100644 index d1cb11c..0000000 --- a/models/POS.dtram +++ /dev/null @@ -1,27 +0,0 @@ -model { -channel CIO { - out payment(p:Int, purchase(x:Int)) = x -} -channel C3 { - in history(h, update3(u)) = u - out total(t:Int, update3(u)) = sum(u) -} -channel C1 { - in payment(p, update1(y)) = y - out points(l:Int, update1(y)) = floor(y * 0.05) -} -channel C2 { - in payment(p, update2(z)) = z - out history(h:List, update2(z)) = cons(z, h) -} -} -geometry { - node c C3:850,90,30,30 - node c C1:500,20,30,30 - node c C2:500,90,30,30 - node r total:1000,90,80,30 - node r payment:300,55,80,30 - node r history:650,90,80,30 - node r points:650,20,80,30 - node ioc CIO:150,55,30,30 -} \ No newline at end of file diff --git a/models/POS.model b/models/POS.model deleted file mode 100644 index c15c931..0000000 --- a/models/POS.model +++ /dev/null @@ -1,15 +0,0 @@ -channel CIO { - out payment(p:Int, purchase(x:Int)) = x -} -channel C3 { - in history(h, update3(u)) = u - out total(t:Int, update3(u)) = sum(u) -} -channel C1 { - in payment(p, update1(y)) = y - out points(l:Int, update1(y)) = floor(y * 0.05) -} -channel C2 { - in payment(p, update2(z)) = z - out history(h:List, update2(z)) = cons(z, h) -} diff --git a/models/POS2.model b/models/POS2.model deleted file mode 100644 index 2a4196b..0000000 --- a/models/POS2.model +++ /dev/null @@ -1,14 +0,0 @@ -channel CIO { - out payment(p:Int, purchase(x:Int)) = x -} - -channel C1 { - in payment(p1, update1(y)) = y - out points(l:Int, update1(y)) = floor(y * 0.05) -} - -channel C2 { - in payment(p1, update2(z)) = z - out history(h:List, update2(z)) = cons(z, h) - out total(t:Int, update2(z)) = z + t -} \ No newline at end of file diff --git a/models/SimpleAddressBook.model b/models/SimpleAddressBook.model deleted file mode 100644 index 9a9f38a..0000000 --- a/models/SimpleAddressBook.model +++ /dev/null @@ -1,11 +0,0 @@ -channel Init { - out book.owner(pre_name: Str, init(name: Str)) = name -} - -channel Add { - out book.addr(pre_addr: Map, add(name: Str, addr: Str)) = insert(pre_addr, name, addr) -} - -channel Del { - out book.addr(pre_addr: Map, del(name: Str)) = delete(pre_addr, name) -} \ No newline at end of file diff --git a/models/SimpleTwitter.model b/models/SimpleTwitter.model deleted file mode 100644 index 486fafb..0000000 --- a/models/SimpleTwitter.model +++ /dev/null @@ -1,7 +0,0 @@ -channel Signup { - out accounts(accountDB:Map, signUp(accountId:Str, name:Str)) = insert(accountDB, accountId, {"name": name, "tweets": nil}) -} - -channel Tweet(accountId:Str) { - out accounts.{accountId}.tweets(tweetList:List, tweet(contents:Str)) = append(tweetList, contents) -} diff --git a/models/SimpleUI2.model b/models/SimpleUI2.model index 8c63896..9af9a97 100644 --- a/models/SimpleUI2.model +++ b/models/SimpleUI2.model @@ -1,8 +1,37 @@ init { screen := { "widgets": { - "001": {"type": "label", "text": "a", "state": 0}, - "002": {"type": "textInput", "text": "", "state": 0} + "001": { + "type": "button", + "text": "a", + "state": 0, + "x": 100, + "y": 100, + "width": 100, + "height": 40, + "onPressed": { + "method": "a" + } + }, + "002": {"type": "textInput", "text": "", "state": 0}, + "003": { + "type": "button", + "text": "change", + "state": 0, + "x": 50, + "y": 50, + "width": 100, + "height": 40, + "onPressed": { + "method": "transition", + "data": { + "widgets": { + "004": {"type": "label", "text": "hello", "state": 0, "x": 100, "y": 100} + }, + "layout": true + } + } + } }, "layout": true } @@ -12,6 +41,10 @@ in screen(curSc: Json, update(curSc, nextSc)) = nextSc } +native channel ChangeScreen { + out screen(curSc: Json, changeScreen(nextSc)) = nextSc +} + native channel SetLayout { in screen.layout(curLayout: Bool, setLayout(nextLayout)) = nextLayout } @@ -36,7 +69,7 @@ out screen.widgets(widgets: Map, addTextInput(wid: Str)) = insert(widgets, wid, {"type": "textInput", "text": "", "state": 0}) } -channel ChangeText { - in screen.widgets.002.text(curText: Str, updateText(newText: Str)) = curText - out screen.widgets.001.text(curText: Str, updateText(newText: Str)) = newText +channel Test(wid: Str) { + in screen.widgets.{wid}.state(curState: Int, test(nextState: Str, wid: Str)) = nextState + out screen.widgets.{wid}.text(curText: Str, test(nextState: Str, wid: Str)) = if(wid == "001", "hello", curText) } diff --git a/models/SimpleUI3.model b/models/SimpleUI3.model new file mode 100644 index 0000000..28506d7 --- /dev/null +++ b/models/SimpleUI3.model @@ -0,0 +1,18 @@ +init { + screen := { + "widgets": { + "001": {"type": "label", "text": "a", "state": 0, "x": 100, "y": 100}, + "002": {"type": "textInput", "text": "", "state": 0} + }, + "layout": true, + "extra": { + "001": {"type": "label", "text": "a", "state": 0, "x": 100, "y": 100} + } + } +} + +native channel ScreenUpdate { + in screen(curSc: Json, update(curSc, nextSc)) = nextSc +} + +native channel diff --git a/models/StockManagement.model b/models/StockManagement.model deleted file mode 100644 index e504d34..0000000 --- a/models/StockManagement.model +++ /dev/null @@ -1,50 +0,0 @@ -init { - stock := nil - shortage := nil -} - -channel CIO_enter { - out arrival(s:Tuple, arrive(item:Str, num:Int)) = tuple(item, num) -} - -channel CIO_req { - out request(r:Tuple, req(item:Str, num:Int)) = tuple(item, num) -} - -channel C1 { - in arrival(ar, update1(ar2, st)) = ar2 - ref stock(st:Map, update1(ar2, st)) - out available(av:Tuple, update1(ar2, st)) = tuple(fst(ar2), snd(ar2) + lookup(st, fst(ar2))) -} - -channel C2 { - in available(av, update2(av2, sh)) = av2 - ref shortage(sh, update2(av2, sh)) - out deriver(dr:Tuple, update2(av2, sh)) = if(snd(av2) >= lookup(sh, fst(av2)), - tuple(fst(av2), lookup(sh, fst(av2)), snd(av2) - lookup(sh, fst(av2))), - tuple(fst(av2), 0, snd(av2))) - out shortage(s, update2(av2, sh)) = if(snd(av2) >= lookup(s, fst(av2)), - insert(s, fst(av2), 0), - s) -} - -channel C3 { - in deriver(dr, update3(dr2)) = dr2 - out stock(st, update3(dr2)) = insert(st, fst(dr2), snd(snd(dr2))) -} - -channel C4 { - in deriver(dr, update4(dr2)) = dr2 - out shipping(sp:Tuple, update4(dr2)) = tuple(fst(dr2), fst(snd(dr2))) -} - -channel C5 { - in request(rq, update5(rq2, st)) = rq2 - ref stock(st, update5(rq2, st)) - out deriver(dr, update5(rq2, st)) = if(lookup(st, fst(rq2)) >= snd(rq2), - tuple(fst(rq2), snd(rq2), lookup(st, fst(rq2)) - snd(rq2)), - tuple(fst(rq2), 0, lookup(st, fst(rq2)))) - out shortage(sh, update5(rq2, st)) = if(lookup(st, fst(rq2)) >= snd(rq2), - sh, - insert(sh, fst(rq2), lookup(sh, fst(rq2)) + snd(rq2))) -} \ No newline at end of file diff --git a/models/StockManagement2.model b/models/StockManagement2.model deleted file mode 100644 index 857b581..0000000 --- a/models/StockManagement2.model +++ /dev/null @@ -1,13 +0,0 @@ -init { - stock := nil - shortage := nil -} - -channel CIO_enter { - out deriver(s:Tuple, arrive(item:Str, num:Int)) = tuple(item, num, num) -} - -channel C3 { - in deriver(dr, update3(dr2)) = dr2 - out shipping(sp:Tuple, update3(dr2)) = tuple(fst(dr2), fst(snd(dr2))) -} diff --git a/models/TravelDistance.model b/models/TravelDistance.model deleted file mode 100644 index 07d12db..0000000 --- a/models/TravelDistance.model +++ /dev/null @@ -1,13 +0,0 @@ -channel CX { - out pos_x(prev_x: Double, setX(cur_x: Double)) = cur_x -} - -channel CY { - out pos_y(prev_y: Double, setY(cur_y: Double)) = cur_y -} - -channel C { - in pos_x(prev_x, move(dx, dy)) = prev_x + dx - in pos_y(prev_y, move(dx, dy)) = prev_y + dy - out dist(prev_d, move(dx, dy)) = prev_d + sqrt(dx * dx + dy * dy) -} diff --git a/models/Triangle.model b/models/Triangle.model deleted file mode 100644 index cf3d0e0..0000000 --- a/models/Triangle.model +++ /dev/null @@ -1,13 +0,0 @@ -channel cio1 { - out base(x: Double, setBase(x2)) = x2 -} - -channel cio2 { - out height(y: Double, setHeight(y2)) = y2 -} - -channel triangle { - in base(x, update(x2, y2)) = x2 - in height(y, update(x2, y2)) = y2 - out hypothenuse(z: Double, update(x2, y2)) = sqrt(x2 * x2 + y2 * y2) -} \ No newline at end of file diff --git a/models/Triangle2.model b/models/Triangle2.model deleted file mode 100644 index 5067fa0..0000000 --- a/models/Triangle2.model +++ /dev/null @@ -1,13 +0,0 @@ -channel cio1 { - out base(x: Double, setBase(x2)) = x2 -} - -channel cio2 { - out height(y: Double, setHeight(y2)) = y2 -} - -channel triangle { - in base(x, update: Tuple) = fst(update) - in height(y, update) = snd(update) - out hypothenuse(z: Double, update) = sqrt(fst(update) * fst(update) + snd(update) * snd(update)) -} \ No newline at end of file diff --git a/models/Twitter.model b/models/Twitter.model deleted file mode 100644 index 887f76f..0000000 --- a/models/Twitter.model +++ /dev/null @@ -1,16 +0,0 @@ -channel CIO1(myId:Str) { - out accounts(ac:List, signup(name:Str)) = cons(tuple(name, nil, nil), t1) -} - -channel CIO2(id:Str) { - out accounts.{id}.tweets(t1:List, tweet(text:Str, time:Long)) = cons(tuple(time, text), t1) -} - -channel C(myId:Str; m:Json) { - in accounts.{myId}.tweets(t1:List, m) = m.myTweets - sub C2(no:Int; flw:Json := m.followees.{no}) { - in accounts.{myId}.followees.{no}(id:Str, flw) = flw.id - in accounts.{flw.id}.tweets(t2:List, flw) = flw.tweets - } - out accounts.{myId}.timeline(l:List, m) = merge(m.myTweets, m.followees) -} \ No newline at end of file diff --git a/models/WOS.dtram b/models/WOS.dtram deleted file mode 100644 index 81b0779..0000000 --- a/models/WOS.dtram +++ /dev/null @@ -1,25 +0,0 @@ -model { -channel CIO2 { - out highest(h:Double, reset(v)) = v -} -channel CIO1 { - out temp_f(p:Double, observe(x)) = x -} -channel C1{ - in temp_f(q:Double, conversion(y)) = y - out temp_c(r:Double, conversion(z)) = (z-32) / 1.8 -} -channel C2{ - in temp_f(q:Double, update(y)) = y - out highest(h:Double, update(z)) = if(z >= h, z, h) -} -} -geometry { - node c C1:500,200,30,30 - node c C2:500,100,30,30 - node r highest:650,100,80,30 - node r temp_c:650,200,80,30 - node r temp_f:250,100,80,30 - node ioc CIO2:100,300,30,30 - node ioc CIO1:100,100,30,30 -} \ No newline at end of file diff --git a/models/WeatherObservationSystem.model b/models/WeatherObservationSystem.model deleted file mode 100644 index 0096407..0000000 --- a/models/WeatherObservationSystem.model +++ /dev/null @@ -1,14 +0,0 @@ -channel CIO2 { - out highest(h:Double, reset(v)) = v -} -channel CIO1 { - out temp_f(p:Double, observe(x)) = x -} -channel C1{ - in temp_f(q:Double, conversion(y)) = y - out temp_c(r:Double, conversion(z)) = (z-32) / 1.8 -} -channel C2{ - in temp_f(q:Double, update(y)) = y - out highest(h:Double, update(z)) = if(z >= h, z, h) -} diff --git a/models/sample.model b/models/sample.model deleted file mode 100644 index f7c93ed..0000000 --- a/models/sample.model +++ /dev/null @@ -1,63 +0,0 @@ - -init { -screen := { - "widgets": { - "0dbaeeb89bf349748ef4f7fc1388fe19": { - "type": "button", - "text": "ボタン", - "state": 0, - "x": 193.1903429031372, - "y": 73, - "width": 96.875, - "height": 37.79829406738281 - }, - "b92b875fe3e442118e512e854fdf6dad": { - "type": "textInput", - "text": "入力欄", - "state": 0, - "x": 178.1903429031372, - "y": 175.79261016845703, - "width": 96.875, - "height": 37.79829406738281 - }, - "47b39829ea8d4949940695f019439711": { - "type": "label", - "text": "テキストラベル", - "state": 0, - "x": 276.1903429031372, - "y": 338.5852279663086, - "width": 96.875, - "height": 57.79829406738281 - } - }, - "layout": true -} -} - -native channel ScreenUpdate { - in screen(curSc: Json, update(curSc, nextSc)) = nextSc -} - -native channel SetLayout { - in screen.layout(curLayout: Bool, setLayout(nextLayout)) = nextLayout -} - -native channel SetVisible(wid: Str) { - in screen.widgets.{wid}.visible(curVisible: Bool, setVisible(nextVisible)) = nextVisible -} - -native channel SetText(wid: Str) { - in screen.widgets.{wid}.text(curText: Str, setText(nextText)) = nextText -} - -native channel MouseEvent(wid: Str) { - out screen.widgets.{wid}.state(curState: Int, mouseEvent(nextState)) = nextState -} - -native channel TextEvent(wid: Str) { - out screen.widgets.{wid}.text(curText: Str, textEvent(nextText)) = nextText -} - -channel AddTextInput { - out screen.widgets(widgets: Map, addTextInput(wid: Str)) = insert(widgets, wid, {"type": "textInput", "text": "", "state": 0}) -}