respond to feedback of chapters 1 & 2
This commit is contained in:
parent
62e4799563
commit
2b008ded78
10 changed files with 262 additions and 301 deletions
|
@ -55,4 +55,11 @@ subgraph cluster_f {
|
|||
//l3_in -> nr3 -> l4;
|
||||
//l10_in -> nr10 -> fee;
|
||||
}
|
||||
{
|
||||
edge [constraint = false, style = dashed];
|
||||
{l3 l10} -> enter_g [style = bold];
|
||||
{l3_in l10_in} -> a_in;
|
||||
//gee -> {fee l4};
|
||||
//gne -> {nr10 nr3};
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -1,5 +1,15 @@
|
|||
digraph g {
|
||||
Start [shape=box];
|
||||
End [shape=box];
|
||||
Start -> "int result = 0" -> "while (x > 0)" -> "result += y" -> "x--" -> "while (x > 0)" -> "System.out.println(result)" -> "return result" -> "End";
|
||||
}
|
||||
digraph g {
|
||||
subgraph a {
|
||||
E [label = "Entry", shape = box];
|
||||
e [label = "Exit", shape = box];
|
||||
c [label = <x_in = 2<br/>y_in = 3<br/>multiply(2, 3)>];
|
||||
E -> c -> e;
|
||||
}
|
||||
|
||||
subgraph b {
|
||||
Entry [shape=box, label = <Entry<br/>x = x_in<br/>y = y_in>];
|
||||
Exit [shape=box];
|
||||
Entry -> "int result = 0" -> "while (x > 0)" -> "result += y" -> "x--" -> "while (x > 0)" -> "System.out.println(result)" -> "return result" -> Exit;
|
||||
{ rank = same; "while (x > 0)"; "System.out.println(result)"}
|
||||
}
|
||||
}
|
Binary file not shown.
|
@ -1,5 +1,11 @@
|
|||
digraph g { "multiply()" [shape=box, rank=min];
|
||||
digraph g {
|
||||
"main()" [shape=box, rank=min]
|
||||
"main()" -> "multiply(2, 3)" -> {"x_in = 2" "y_in = 3"};
|
||||
|
||||
"multiply()" [shape=box, rank=min];
|
||||
"multiply()" ->
|
||||
// Rank adjustment
|
||||
{ rank = same; "x = x_in" "y = y_in" }
|
||||
{ rank = same; "int result = 0"; "while (x > 0)"; "System.out.println(result)"; "return result"; }
|
||||
{ rank = same; "result += y"; "x--"; }
|
||||
// Control flow
|
||||
|
@ -10,17 +16,17 @@ digraph g { "multiply()" [shape=box, rank=min];
|
|||
"while (x > 0)" -> "result += y" [style=bold];
|
||||
"while (x > 0)" -> "x--" [style=bold];
|
||||
// Data flow
|
||||
"int result = 0" -> "result += y" [color=red];
|
||||
"int result = 0" -> "System.out.println(result)" [color=red];
|
||||
"int result = 0" -> "return result" [color=red];
|
||||
"result += y" -> "result += y" [color=red];
|
||||
"result += y" -> "System.out.println(result)" [color=red];
|
||||
"result += y" -> "return result" [color=red];
|
||||
"x--" -> "x--" [color=red];
|
||||
"x--" -> "while (x > 0)" [color=red];
|
||||
{ edge [color = red]
|
||||
{"int result = 0" "result += y"} -> {"result += y" "System.out.println(result)" "return result"};
|
||||
{"x--" "x = x_in"} -> {"x--" "while (x > 0)"};
|
||||
"y = y_in" -> "result += y";
|
||||
}
|
||||
// Order adjustment
|
||||
"int result = 0" -> "while (x > 0)" [style=invis];
|
||||
"while (x > 0)" -> "System.out.println(result)" [style=invis];
|
||||
"System.out.println(result)" -> "return result" [style=invis];
|
||||
"result += y" -> "x--" [style=invis];
|
||||
{ edge [style = invis];
|
||||
"int result = 0" -> "while (x > 0)";
|
||||
"while (x > 0)" -> "System.out.println(result)";
|
||||
"System.out.println(result)" -> "return result";
|
||||
"result += y" -> "x--";
|
||||
"x = x_in" -> "int result = 0";
|
||||
}
|
||||
}
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue