diff --git a/AlgebraicDataflowArchitectureModel/.classpath b/AlgebraicDataflowArchitectureModel/.classpath
new file mode 100644
index 0000000..3e99697
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/.classpath
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/AlgebraicDataflowArchitectureModel/.gitignore b/AlgebraicDataflowArchitectureModel/.gitignore
new file mode 100644
index 0000000..3e2fcc7
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/AlgebraicDataflowArchitectureModel/.project b/AlgebraicDataflowArchitectureModel/.project
new file mode 100644
index 0000000..15e3364
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/.project
@@ -0,0 +1,17 @@
+
+
+ AlgebraicDataflowArchitectureModel
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/AlgebraicDataflowArchitectureModel/.settings/org.eclipse.jdt.core.prefs b/AlgebraicDataflowArchitectureModel/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..263a512
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,15 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=13
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=13
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning
+org.eclipse.jdt.core.compiler.release=disabled
+org.eclipse.jdt.core.compiler.source=13
diff --git a/AlgebraicDataflowArchitectureModel/dtram.log b/AlgebraicDataflowArchitectureModel/dtram.log
new file mode 100644
index 0000000..8a64fa5
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/dtram.log
@@ -0,0 +1,44 @@
+3月 15, 2024 3:10:09 午後 application.ApplicationWindow
+情報: launched
+3月 15, 2024 3:10:14 午後 application.actions.AbstractSystemAction actionPerformed
+情報: 開く
+3月 15, 2024 3:10:33 午後 application.views.NavigationWindow stageChanged
+情報: application.editor.stages.DataFlowModelingStage@3d463297
+3月 15, 2024 3:10:33 午後 application.views.NavigationWindow stageChanged
+情報: application.editor.stages.PushPullSelectionStage@37c62c43
+3月 15, 2024 3:29:48 午後 application.ApplicationWindow
+情報: launched
+3月 15, 2024 3:29:51 午後 application.actions.AbstractSystemAction actionPerformed
+情報: 開く
+3月 15, 2024 3:29:55 午後 application.views.NavigationWindow stageChanged
+情報: application.editor.stages.DataFlowModelingStage@3f75cd3f
+3月 15, 2024 3:29:55 午後 application.views.NavigationWindow stageChanged
+情報: application.editor.stages.PushPullSelectionStage@187ec296
+3月 15, 2024 3:29:59 午後 application.editor.stages.PushPullSelectionCellEditor stopEditing
+情報: PUSH
+3月 15, 2024 3:30:01 午後 application.editor.stages.PushPullSelectionCellEditor stopEditing
+情報: PUSH
+3月 15, 2024 3:30:03 午後 application.editor.stages.ControlFlowDelegationCellEditor startEditing
+情報: Double clicked
+3月 15, 2024 3:30:03 午後 application.editor.stages.ControlFlowDelegationCellEditor startEditing
+情報: Selecting Control-Flow (src, dst) = (updateGPS, longitude)
+3月 15, 2024 3:30:05 午後 application.editor.stages.ControlFlowDelegationStage$2 mouseReleased
+情報: Reset selection
+3月 15, 2024 3:30:07 午後 application.editor.stages.ControlFlowDelegationCellEditor startEditing
+情報: Double clicked
+3月 15, 2024 3:30:07 午後 application.editor.stages.ControlFlowDelegationCellEditor startEditing
+情報: Selecting Control-Flow (src, dst) = (longitude, mapLongitude)
+3月 15, 2024 3:30:07 午後 application.editor.stages.ControlFlowDelegationStage$2 mouseReleased
+情報: Reset selection
+3月 15, 2024 3:31:24 午後 application.editor.stages.ControlFlowDelegationCellEditor startEditing
+情報: Double clicked
+3月 15, 2024 3:31:24 午後 application.editor.stages.ControlFlowDelegationCellEditor startEditing
+情報: Selecting Control-Flow (src, dst) = (updateGPS, longitude)
+3月 15, 2024 3:31:25 午後 application.editor.stages.ControlFlowDelegationStage$2 mouseReleased
+情報: Reset selection
+3月 15, 2024 3:31:33 午後 application.editor.stages.ControlFlowDelegationCellEditor startEditing
+情報: Double clicked
+3月 15, 2024 3:31:33 午後 application.editor.stages.ControlFlowDelegationCellEditor startEditing
+情報: Selecting Control-Flow (src, dst) = (updateGPS, longitude)
+3月 15, 2024 3:31:39 午後 application.editor.stages.ControlFlowDelegationStage$2 mouseReleased
+情報: Reset selection
diff --git a/AlgebraicDataflowArchitectureModel/lib/jgraphx.jar b/AlgebraicDataflowArchitectureModel/lib/jgraphx.jar
new file mode 100644
index 0000000..72b5aae
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/lib/jgraphx.jar
Binary files differ
diff --git a/AlgebraicDataflowArchitectureModel/models/Algolike.model b/AlgebraicDataflowArchitectureModel/models/Algolike.model
new file mode 100644
index 0000000..aa943d3
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/Algolike.model
@@ -0,0 +1,113 @@
+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(eq(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(eq(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(eq(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(eq(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)) == eq(length(extractFaceDown(j)), 0)
+}
+channel judgeB{
+ in handsB(b:List, judge(j)) == j
+ out loseB(lb:Bool, judge(j)) == eq(length(extractFaceDown(j)), 0)
+}
\ No newline at end of file
diff --git a/AlgebraicDataflowArchitectureModel/models/Audio.dtram b/AlgebraicDataflowArchitectureModel/models/Audio.dtram
new file mode 100644
index 0000000..66862ef
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/Audio.dtram
@@ -0,0 +1,33 @@
+model {
+channel CIO3 {
+ out BGMVolume(b: Double, setBGM(b2)) == b2
+}
+channel CIO2 {
+ out soundVolume(s: Double, setSound(s2)) == s2
+}
+channel CIO1 {
+ out audioVolume(a: Double, setAudio(a2)) == a2
+}
+channel C1 {
+ in audioVolume(a, calc(a2, s2)) == a2
+ in soundVolume(s, calc(a2, s2)) == s2
+ out outputSoundVolume(os, calc(a2, s2)) == a2 * s2
+}
+channel C2 {
+ in audioVolume(a, calc(a2, b2)) == a2
+ in BGMVolume(b, calc(a2, b2)) == b2
+ out outputBGMVolume(ob, calc(a2, b2)) == a2 * b2
+}
+}
+geometry {
+ node r soundVolume:220,140,80,30
+ node r audioVolume:220,280,80,30
+ node r outputSoundVolume:650,190,80,30
+ node r BGMVolume:220,420,80,30
+ node r outputBGMVolume:650,340,80,30
+ node ioc CIO3:100,420,30,30
+ node ioc CIO2:100,140,30,30
+ node ioc CIO1:100,280,30,30
+ node c C1:530,190,30,30
+ node c C2:530,340,30,30
+}
diff --git a/AlgebraicDataflowArchitectureModel/models/Base.model b/AlgebraicDataflowArchitectureModel/models/Base.model
new file mode 100644
index 0000000..2236c0c
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/Base.model
@@ -0,0 +1,13 @@
+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/AlgebraicDataflowArchitectureModel/models/Clock.dtram b/AlgebraicDataflowArchitectureModel/models/Clock.dtram
new file mode 100644
index 0000000..ae2169e
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/Clock.dtram
@@ -0,0 +1,27 @@
+model {
+ channel CIO1 {
+ out min(m: Double, tick) == mod(m + 1, 60)
+ }
+ channel Clock {
+ in min(m, update(m2)) == m2
+ out hour(h: Double, update(m2)) == if(eq(m2, 0), mod(h + 1, 24), h)
+ }
+ channel MinUpdate {
+ in min(m, update(m2)) == m2
+ out min_ang(m_ang: Double, update(m2)) == m2 / 30 * PI
+ }
+ channel HourUpdate {
+ in hour(h, update(h2)) == h2
+ out hour_ang(h_ang: Double, update(h2)) == h2 / 6 * PI
+ }
+}
+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/AlgebraicDataflowArchitectureModel/models/CustomerOffice.model b/AlgebraicDataflowArchitectureModel/models/CustomerOffice.model
new file mode 100644
index 0000000..f140bff
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/CustomerOffice.model
@@ -0,0 +1,33 @@
+channel C_CustomerAOff_In {
+ out customerA_off(c:String, setOff(x)) == x
+ out customerA_off(c, e) == c
+}
+
+channel C_CustomerBOff_In {
+ out customerB_off(c:String, setOff(x)) == x
+ out customerB_off(c, e) == c
+}
+
+channel C_CompanyC1Add_In {
+ out companyC1_add(a:String, setAdd(y)) == y
+ out companyC1_add(a, e) == a
+}
+
+channel C_CompanyC2Add_In {
+ out companyC2_add(a:String, setAdd(y)) == y
+ out companyC2_add(a, e) == a
+}
+
+channel CA {
+ in customerA_off(c, sync(z, u, v)) == z
+ in companyC1_add(a1, sync(z, u, v)) == u
+ in companyC2_add(a2, sync(z, u, v)) == v
+ out customerA_add(a3:String, sync(z, u, v)) == if(eq(z, C1), u, if(eq(z, C2), v, null))
+}
+
+channel CB {
+ in customerB_off(c, sync(z, u, v)) == z
+ in companyC1_add(a1, sync(z, u, v)) == u
+ in companyC2_add(a2, sync(z, u, v)) == v
+ out customerB_add(a3:String, sync(z, u, v)) == if(eq(z, C1), u, if(eq(z, C2), v, null))
+}
diff --git a/AlgebraicDataflowArchitectureModel/models/Game.model b/AlgebraicDataflowArchitectureModel/models/Game.model
new file mode 100644
index 0000000..bc90ba4
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/Game.model
@@ -0,0 +1,32 @@
+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/AlgebraicDataflowArchitectureModel/models/JumpGame.model b/AlgebraicDataflowArchitectureModel/models/JumpGame.model
new file mode 100644
index 0000000..4c24a56
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/JumpGame.model
@@ -0,0 +1,71 @@
+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(and(o, lt(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(and(eq(g, true), lt(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)) == and(eq(g2, true), le(right(p2), 0.0))
+}
+channel C7 {
+ in position(p, update7(p2)) == p2
+ out clear(c:Bool, update7(p2)) == if(gt(left(p2), 100.0), true, false)
+ out gameover(go:Bool, update7(p2)) == if(lt(right(p2), -1.0), true, false)
+}
\ No newline at end of file
diff --git a/AlgebraicDataflowArchitectureModel/models/Kinetics.model b/AlgebraicDataflowArchitectureModel/models/Kinetics.model
new file mode 100644
index 0000000..5218206
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/Kinetics.model
@@ -0,0 +1,20 @@
+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/AlgebraicDataflowArchitectureModel/models/Map.dtram b/AlgebraicDataflowArchitectureModel/models/Map.dtram
new file mode 100644
index 0000000..b1fe577
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/Map.dtram
@@ -0,0 +1,23 @@
+model {
+ channel GPS_In {
+ out longitude(prev_long: Double, updateGPS(cur_long, cur_lat)) == cur_long
+ out latitude(prev_lat: Double, updateGPS(cur_long, cur_lat)) == cur_lat
+ }
+ channel LongUpdate {
+ in longitude(prev_long, updateLong(cur_long)) == cur_long
+ out mapLongitude(prev_mapLong, updateLong(cur_long)) == cur_long
+ }
+ channel LatUpdate {
+ in latitude(prev_lat, updateLat(cur_lat)) == cur_lat
+ out mapLatitude(prev_mapLat, updateLat(cur_lat)) == cur_lat
+ }
+}
+geometry {
+ node r mapLatitude:580,310,80,30
+ node r latitude:190,310,80,30
+ node r mapLongitude:580,170,80,30
+ node r longitude:190,170,80,30
+ node ioc GPS_In:40,60,30,30
+ node c LongUpdate:410,170,30,30
+ node c LatUpdate:410,310,30,30
+}
diff --git a/AlgebraicDataflowArchitectureModel/models/Map.model b/AlgebraicDataflowArchitectureModel/models/Map.model
new file mode 100644
index 0000000..2ea85ff
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/Map.model
@@ -0,0 +1,14 @@
+channel GPS_In {
+ out longitude(prev_long: Double, updateGPS(cur_long, cur_lat)) == cur_long
+ out latitude(prev_lat: Double, updateGPS(cur_long, cur_lat)) == cur_lat
+}
+
+channel LongUpdate {
+ in longitude(prev_long, updateLong(cur_long)) == cur_long
+ out mapLongitude(prev_mapLong, updateLong(cur_long)) == cur_long
+}
+
+channel LatUpdate {
+ in latitude(prev_lat, updateLat(cur_lat)) == cur_lat
+ out mapLatitude(prev_mapLat, updateLat(cur_lat)) == cur_lat
+}
diff --git a/AlgebraicDataflowArchitectureModel/models/POS.dtram b/AlgebraicDataflowArchitectureModel/models/POS.dtram
new file mode 100644
index 0000000..53eb13d
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/POS.dtram
@@ -0,0 +1,27 @@
+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/AlgebraicDataflowArchitectureModel/models/POS.model b/AlgebraicDataflowArchitectureModel/models/POS.model
new file mode 100644
index 0000000..fc941ca
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/POS.model
@@ -0,0 +1,15 @@
+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/AlgebraicDataflowArchitectureModel/models/POS2.model b/AlgebraicDataflowArchitectureModel/models/POS2.model
new file mode 100644
index 0000000..6ae676d
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/POS2.model
@@ -0,0 +1,14 @@
+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/AlgebraicDataflowArchitectureModel/models/SSDStore.dtram b/AlgebraicDataflowArchitectureModel/models/SSDStore.dtram
new file mode 100644
index 0000000..e226ec0
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/SSDStore.dtram
@@ -0,0 +1,33 @@
+model {
+ channel capacity_In {
+ out capacity(prev_capacity:Int, setCapacity(cur_capacity)) == cur_capacity
+ }
+ channel price_In {
+ out price(prev_price:Int, setPrice(cur_price)) == cur_price
+ }
+ channel siteA_Add {
+ out siteA(prev_products:List, addProductToSiteA(price:Int, capacity:Int)) == cons({"price": price, "capacity": capacity}, prev_products)
+ }
+ channel capacity_Update {
+ in siteA(prev_products:List, updateList(cur_products, cur_capacity)) == cur_products
+ in capacity(prev_capacity:Int, updateList(cur_products, cur_capacity)) == cur_capacity
+ out itemsByCapacity(prev_items:List, updateList(cur_products, cur_capacity)) == selectGE(cur_products, "capacity", cur_capacity)
+ }
+ channel price_Update {
+ in siteA(prev_products:List, updateList(cur_products, cur_price)) == cur_products
+ in price(prev_price:Int, updateList(cur_products, cur_price)) == cur_price
+ out itemsByPrice(prev_items:List, updateList(cur_products, cur_price)) == selectLE(cur_products, "price", cur_price)
+ }
+}
+geometry {
+ node r price:250,40,80,30
+ node r itemsByPrice:650,110,80,30
+ node r itemsByCapacity:650,280,80,30
+ node r siteA:250,200,80,30
+ node r capacity:250,370,80,30
+ node ioc capacity_In:100,370,30,30
+ node ioc price_In:100,40,30,30
+ node ioc siteA_Add:100,200,30,30
+ node c capacity_Update:500,280,30,30
+ node c price_Update:500,110,30,30
+}
diff --git a/AlgebraicDataflowArchitectureModel/models/SSDStore.model b/AlgebraicDataflowArchitectureModel/models/SSDStore.model
new file mode 100644
index 0000000..e8696fe
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/SSDStore.model
@@ -0,0 +1,23 @@
+channel capacity_In {
+ out capacity(prev_capacity:Int, setCapacity(cur_capacity)) == cur_capacity
+}
+
+channel price_In {
+ out price(prev_price:Int, setPrice(cur_price)) == cur_price
+}
+
+channel siteA_Add {
+ out siteA(prev_products:List, addProductToSiteA(price:Int, capacity:Int)) == cons({"price": price, "capacity": capacity}, prev_products)
+}
+
+channel capacity_Update {
+ in siteA(prev_products:List, updateList(cur_products, cur_capacity)) == cur_products
+ in capacity(prev_capacity:Int, updateList(cur_products, cur_capacity)) == cur_capacity
+ out itemsByCapacity(prev_items:List, updateList(cur_products, cur_capacity)) == selectGE(cur_products, "capacity", cur_capacity)
+}
+
+channel price_Update {
+ in siteA(prev_products:List, updateList(cur_products, cur_price)) == cur_products
+ in price(prev_price:Int, updateList(cur_products, cur_price)) == cur_price
+ out itemsByPrice(prev_items:List, updateList(cur_products, cur_price)) == selectLE(cur_products, "price", cur_price)
+}
\ No newline at end of file
diff --git a/AlgebraicDataflowArchitectureModel/models/SamplePULL.dtram b/AlgebraicDataflowArchitectureModel/models/SamplePULL.dtram
new file mode 100644
index 0000000..0c06ae8
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/SamplePULL.dtram
@@ -0,0 +1,21 @@
+model {
+ channel setAChannel {
+ out a(aValue:Int, setA(value)) == value
+ }
+ channel outBChannel {
+ in a(aValue:Int, calcB(aValue)) == aValue
+ out b(bValue:Int ,calcB(aValue)) == aValue * 2
+ }
+ channel outCChannel {
+ in a(aValue:Int, calcC(aValue)) == aValue
+ out c(cValue:Int, calcC(aValue)) == aValue + 1
+ }
+}
+geometry {
+ node r a:250,170,80,30
+ node r b:580,80,80,30
+ node r c:590,280,80,30
+ node ioc setAChannel:90,170,30,30
+ node c outBChannel:430,80,30,30
+ node c outCChannel:440,280,30,30
+}
diff --git a/AlgebraicDataflowArchitectureModel/models/SamplePUSH.dtram b/AlgebraicDataflowArchitectureModel/models/SamplePUSH.dtram
new file mode 100644
index 0000000..c07e68b
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/SamplePUSH.dtram
@@ -0,0 +1,15 @@
+model {
+ channel setAChannel {
+ out a(aValue:Int, setA(value)) == value
+ }
+ channel updateBChannel {
+ in a(aValue:Int, updateB(aValue)) == aValue
+ out b(bValue:Int, updateB(aValue)) == bValue + aValue
+ }
+}
+geometry {
+ node r a:270,270,80,30
+ node r b:660,270,80,30
+ node ioc setAChannel:90,240,100,90
+ node c updateBChannel:460,240,100,90
+}
diff --git a/AlgebraicDataflowArchitectureModel/models/StockManagement.model b/AlgebraicDataflowArchitectureModel/models/StockManagement.model
new file mode 100644
index 0000000..b133f44
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/StockManagement.model
@@ -0,0 +1,50 @@
+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(ge(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(ge(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(ge(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(ge(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/AlgebraicDataflowArchitectureModel/models/TravelDistance.model b/AlgebraicDataflowArchitectureModel/models/TravelDistance.model
new file mode 100644
index 0000000..a0c8fe2
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/TravelDistance.model
@@ -0,0 +1,13 @@
+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/AlgebraicDataflowArchitectureModel/models/Triangle.model b/AlgebraicDataflowArchitectureModel/models/Triangle.model
new file mode 100644
index 0000000..ebfe6b4
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/Triangle.model
@@ -0,0 +1,13 @@
+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/AlgebraicDataflowArchitectureModel/models/Triangle2.model b/AlgebraicDataflowArchitectureModel/models/Triangle2.model
new file mode 100644
index 0000000..db775bd
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/Triangle2.model
@@ -0,0 +1,13 @@
+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/AlgebraicDataflowArchitectureModel/models/Twitter.model b/AlgebraicDataflowArchitectureModel/models/Twitter.model
new file mode 100644
index 0000000..57de3b3
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/Twitter.model
@@ -0,0 +1,47 @@
+channel a_Tweet {
+ out a_tweets(l:List, a_tweet(t:Str, time:Long)) == cons(tuple(time, t), l)
+}
+
+channel a_Follow {
+ out a_following(f:List, a_follow(u:Int)) == cons(u, f)
+}
+
+channel a_Home {
+ in a_tweets(la1, update_a(f2, la2, lb2, lc2)) == la2
+ in b_tweets(lb1, update_a(f2, la2, lb2, lc2)) == lb2
+ in c_tweets(lc1, update_a(f2, la2, lb2, lc2)) == lc2
+ in a_following(f, update_a(f2, la2, lb2, lc2)) == f2
+ out a_timeline(t:List, update_a(f2, la2, lb2, lc2)) == merge(la2, if(contains(f2,2), merge(lb2, if(contains(f2,3), lc2, nil)), if(contains(f2,3), lc2, nil)))
+}
+
+channel b_Tweet {
+ out b_tweets(l:List, b_tweet(t:Str, time:Long)) == cons(tuple(time, t), l)
+}
+
+channel b_Follow {
+ out b_following(f:List, b_follow(u:Int)) == cons(u, f)
+}
+
+channel b_Home {
+ in a_tweets(la1, update_b(f2, la2, lb2, lc2)) == la2
+ in b_tweets(lb1, update_b(f2, la2, lb2, lc2)) == lb2
+ in c_tweets(lc1, update_b(f2, la2, lb2, lc2)) == lc2
+ in b_following(f, update_b(f2, la2, lb2, lc2)) == f2
+ out b_timeline(t:List, update_b(f2, la2, lb2, lc2)) == merge(lb2, if(contains(f2,1), merge(la2, if(contains(f2,3), lc2, nil)), if(contains(f2,3), lc2, nil)))
+}
+
+channel c_Tweet {
+ out c_tweets(l:List, c_tweet(t:Str, time:Long)) == cons(tuple(time, t), l)
+}
+
+channel c_Follow {
+ out c_following(f:List, c_follow(u:Int)) == cons(u, f)
+}
+
+channel c_Home {
+ in a_tweets(la1, update_c(f2, la2, lb2, lc2)) == la2
+ in b_tweets(lb1, update_c(f2, la2, lb2, lc2)) == lb2
+ in c_tweets(lc1, update_c(f2, la2, lb2, lc2)) == lc2
+ in c_following(f, update_c(f2, la2, lb2, lc2)) == f2
+ out c_timeline(t:List, update_c(f2, la2, lb2, lc2)) == merge(lc2, if(contains(f2,1), merge(la2, if(contains(f2,2), lb2, nil)), if(contains(f2,2), lb2, nil)))
+}
diff --git a/AlgebraicDataflowArchitectureModel/models/WOS.dtram b/AlgebraicDataflowArchitectureModel/models/WOS.dtram
new file mode 100644
index 0000000..bbffde1
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/WOS.dtram
@@ -0,0 +1,25 @@
+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(gt(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/AlgebraicDataflowArchitectureModel/models/WeatherObservationSystem.model b/AlgebraicDataflowArchitectureModel/models/WeatherObservationSystem.model
new file mode 100644
index 0000000..f16d38f
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/models/WeatherObservationSystem.model
@@ -0,0 +1,14 @@
+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(gt(z, h), z, h)
+}
diff --git a/AlgebraicDataflowArchitectureModel/resources/locales/en.properties b/AlgebraicDataflowArchitectureModel/resources/locales/en.properties
new file mode 100644
index 0000000..ac26d9b
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/resources/locales/en.properties
@@ -0,0 +1,49 @@
+# File
+file=File
+new=New
+open=Open
+save=Save
+saveAs=Save As...
+exit=Exit
+
+# New
+newModel=Model
+newResources=Resources...
+newChannel=Channel...
+newEventChannel=Event Channel
+newFormulaChannel=Formula Channel
+
+# Edit
+edit=Edit
+delete=Delete
+
+# Layout
+layout=Layout
+dagLayout=DAG Layout
+treeLayout=Tree Layout
+circleLayout=Circle Layout
+
+# View
+view=View
+zoomIn=Zoom In
+zoomOut=Zoom Out
+
+# Generate
+generate=Generate
+generateJava=Generate Plain Java Prototype
+generateJAX_RS=Generate Plain JAX-RS Prototype
+
+# Window
+window=Window
+showNavigation=Show Navigation
+showFlowLayer=Show Flow Layer
+
+# Navigation
+dataFlowModeling=Data-Flow Modeling
+pushpullSelection = PUSH/PULL Selection
+pushpullExtension = PUSH/PULL Extension
+
+# PopUp Actions
+changeCallOrder=Change Call Order
+insertMediator=Introduce Mediator
+dependsOnMediator=Depends On Mediator
diff --git a/AlgebraicDataflowArchitectureModel/resources/locales/ja.properties b/AlgebraicDataflowArchitectureModel/resources/locales/ja.properties
new file mode 100644
index 0000000..bc7288a
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/resources/locales/ja.properties
@@ -0,0 +1,49 @@
+# File
+file=\u30D5\u30A1\u30A4\u30EB
+new=\u65B0\u898F
+open=\u958B\u304F
+save=\u4FDD\u5B58
+saveAs=\u4E0A\u66F8\u304D\u4FDD\u5B58
+exit=\u9589\u3058\u308B
+
+# New
+newModel=\u30E2\u30C7\u30EB
+newResources=\u30EA\u30BD\u30FC\u30B9
+newChannel=\u30C1\u30E3\u30F3\u30CD\u30EB
+newEventChannel=\u30A4\u30D9\u30F3\u30C8\u30C1\u30E3\u30F3\u30CD\u30EB
+newFormulaChannel=\u30D5\u30A9\u30FC\u30DF\u30E5\u30E9\u30C1\u30E3\u30F3\u30CD\u30EB
+
+# Edit
+edit=\u7DE8\u96C6
+delete=\u524A\u9664
+
+# Layout
+layout=\u30EC\u30A4\u30A2\u30A6\u30C8
+dagLayout=DAG \u30EC\u30A4\u30A2\u30A6\u30C8
+treeLayout=\u30C4\u30EA\u30FC\u30EC\u30A4\u30A2\u30A6\u30C8
+circleLayout=\u30B5\u30FC\u30AF\u30EB\u30EC\u30A4\u30A2\u30A6\u30C8
+
+# View
+view=\u8868\u793A
+zoomIn=\u62E1\u5927
+zoomOut=\u7E2E\u5C0F
+
+# Generate
+generate=\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u751F\u6210
+generateJava=Java\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u306E\u751F\u6210
+generateJAX_RS=JAX-RS\u30D7\u30ED\u30C8\u30BF\u30A4\u30D7\u306E\u751F\u6210
+
+# Window
+window=\u30A6\u30A3\u30F3\u30C9\u30A6
+showNavigation=\u30CA\u30D3\u30B2\u30FC\u30B7\u30E7\u30F3
+showFlowLayer=\u30D5\u30ED\u30FC\u30EC\u30A4\u30E4\u30FC
+
+# Navigation
+dataFlowModeling=\u30C7\u30FC\u30BF\u30D5\u30ED\u30FC\u30E2\u30C7\u30EA\u30F3\u30B0
+pushpullSelection = PUSH/PULL\u306E\u9078\u629E
+pushpullExtension = PUSH/PULL\u306E\u62E1\u5F35
+
+# PopUp Actions
+changeCallOrder=\u547C\u3073\u51FA\u3057\u9806\u306E\u5909\u66F4
+insertMediator=\u4EF2\u4ECB\u8005\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u306E\u5C0E\u5165
+dependsOnMediator=\u4EF2\u4ECB\u8005\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u3078\u4F9D\u5B58
\ No newline at end of file
diff --git a/AlgebraicDataflowArchitectureModel/src/Main.java b/AlgebraicDataflowArchitectureModel/src/Main.java
new file mode 100644
index 0000000..54fdaf8
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/src/Main.java
@@ -0,0 +1,12 @@
+
+
+import application.ApplicationWindow;
+
+public class Main {
+
+ public static void main(String[] args) {
+ ApplicationWindow frame = new ApplicationWindow();
+ frame.setVisible(true);
+ }
+
+}
diff --git a/AlgebraicDataflowArchitectureModel/src/algorithms/DataTransferModelAnalyzer.java b/AlgebraicDataflowArchitectureModel/src/algorithms/DataTransferModelAnalyzer.java
new file mode 100644
index 0000000..ff4c528
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/src/algorithms/DataTransferModelAnalyzer.java
@@ -0,0 +1,107 @@
+package algorithms;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+
+import models.*;
+import models.algebra.*;
+import models.dataConstraintModel.*;
+import models.dataFlowModel.*;
+
+/**
+ * Algorithms to analyze data transfer model.
+ *
+ * @author Nitta
+ *
+ */
+public class DataTransferModelAnalyzer {
+ /**
+ * Create data flow graph annotated with node attributes that indicate whether each resource state needs to be stored.
+ * @param model a data transfer model
+ * @return annotated data flow graph
+ */
+ static public DataFlowGraph createDataFlowGraphWithStateStoringAttribute(DataTransferModel model) {
+ DataFlowGraph graph = model.getDataFlowGraph();
+ Collection channels = new HashSet<>(model.getIOChannels());
+ channels.addAll(model.getChannels());
+ for (Channel channel: channels) {
+ for (ChannelMember member: ((DataTransferChannel) channel).getOutputChannelMembers()) {
+ boolean toBeStored = !member.getStateTransition().isRightUnary(); // The state does not need to be stored if the state transition function is right unary.
+ for (Node node: graph.getNodes()) {
+ if (((ResourceNode) node).getResource().equals(member.getResource())) {
+ setStoreAttribute((ResourceNode) node, toBeStored);
+ }
+ }
+ }
+ }
+ for (Node node: graph.getNodes()) {
+ HashSet inChannels = new HashSet<>();
+ for(Edge inEdge: ((ResourceNode) node).getInEdges()) {
+ inChannels.add(((DataFlowEdge) inEdge).getChannel());
+ }
+ if ((inChannels.size() > 1)) {
+ // If the resource has multiple input channels, then the state of the resource needs to be stored.
+ setStoreAttribute((ResourceNode) node, true);
+ } else if (((ResourceNode) node).getAttribute() == null) {
+ setStoreAttribute((ResourceNode) node, false);
+ }
+ }
+ return graph;
+ }
+
+ static private void setStoreAttribute(ResourceNode node, boolean toBeStored) {
+ NodeAttribute attr = node.getAttribute();
+ StoreAttribute store;
+ if (attr != null && attr instanceof NodeAttribute) {
+ store = (StoreAttribute) attr;
+ store.setNeeded(store.isNeeded() || toBeStored);
+ } else {
+ store = new StoreAttribute();
+ store.setNeeded(toBeStored);
+ node.setAttribute(store);
+ }
+ }
+
+ /**
+ * Annotate data flow graph with edge attributes that indicate selectable data transfer methods.
+ * @param graph a data flow graph
+ * @return annotated data flow graph
+ */
+ static public DataFlowGraph annotateWithSelectableDataTransferAttiribute(DataFlowGraph graph) {
+ List nodes = new ArrayList<>(graph.getNodes());
+ // set push only attributes
+ for (Node n: graph.getNodes()) {
+ if (nodes.contains(n) && ((StoreAttribute) ((ResourceNode) n).getAttribute()).isNeeded()) {
+ nodes.remove(n);
+ trackEdges(n, nodes);
+ }
+ }
+ // set push/pull attributes to the remaining edges
+ for (Edge e : graph.getEdges()) {
+ if (((DataFlowEdge) e).getAttribute() == null) {
+ PushPullAttribute ppat = new PushPullAttribute();
+ ppat.addOption(PushPullValue.PUSHorPULL);
+ ppat.addOption(PushPullValue.PUSH);
+ ppat.addOption(PushPullValue.PULL);
+ ((DataFlowEdge) e).setAttribute(ppat);
+ }
+ }
+ return graph;
+ }
+
+ static private void trackEdges(Node n, List nodes) {
+ // recursively set push only attributes to input side edges
+ for (Edge e : ((ResourceNode) n).getInEdges()) {
+ PushPullAttribute ppat = new PushPullAttribute();
+ ppat.addOption(PushPullValue.PUSH);
+ ((DataFlowEdge) e).setAttribute(ppat);
+ Node n2 = e.getSource();
+ if (nodes.contains(n2)) {
+ nodes.remove(n2);
+ trackEdges(n2, nodes);
+ }
+ }
+ }
+}
diff --git a/AlgebraicDataflowArchitectureModel/src/algorithms/TypeInference.java b/AlgebraicDataflowArchitectureModel/src/algorithms/TypeInference.java
new file mode 100644
index 0000000..9b3ca65
--- /dev/null
+++ b/AlgebraicDataflowArchitectureModel/src/algorithms/TypeInference.java
@@ -0,0 +1,2076 @@
+package algorithms;
+
+import java.util.AbstractMap;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import javax.xml.crypto.Data;
+
+import models.Node;
+import models.algebra.Constant;
+import models.algebra.Expression;
+import models.algebra.Position;
+import models.algebra.Symbol;
+import models.algebra.Term;
+import models.algebra.Type;
+import models.algebra.Variable;
+import models.dataConstraintModel.Channel;
+import models.dataConstraintModel.ChannelMember;
+import models.dataConstraintModel.DataConstraintModel;
+import models.dataConstraintModel.JsonType;
+import models.dataConstraintModel.ResourcePath;
+import models.dataConstraintModel.StateTransition;
+import models.dataFlowModel.DataTransferModel;
+import models.dataFlowModel.ResourceNode;
+
+/**
+ * Type inference for data transfer model
+ *
+ * @author Nitta
+ *
+ */
+public class TypeInference {
+ static private Map listTypes = new HashMap<>();
+ static private Map listComponentTypes = new HashMap<>();
+ static private Map, Type> tupleTypes = new HashMap<>();
+ static private Map> tupleComponentTypes = new HashMap<>();
+ static private Map pairTypes = new HashMap<>();
+ static private Map pairComponentTypes = new HashMap<>();
+ static private Map, Type> mapTypes = new HashMap<>();
+ static private Map> mapComponentTypes = new HashMap<>();
+ static private Map