Skip to content

Instantly share code, notes, and snippets.

@shouichi
Created December 5, 2011 16:59
Show Gist options
  • Save shouichi/1434319 to your computer and use it in GitHub Desktop.
Save shouichi/1434319 to your computer and use it in GitHub Desktop.
digraph Emulation {
graph [ label = "State Transitions of SocketChannel#connect (emulation)" ]
rankdir=LR;
size="8,5"
node [ shape = doublecircle ];
Start;
node [ shape = point ];
P1; P2; P3; P4; P5; P6; P7;
node [ shape = circle ];
Opened; Pending1; Connected; Pending2;
Pending1 [ label = "Pending\n (connected = f\n pending = t)" ];
Pending2 [ label = "Pending\n (connected = t\n pending = t)" ];
Connected [ label = "Connected\n (connected = t\n pending = f)" ];
{
rank = same;
Start; Pending1; P1; Opened;
}
{
rank = same;
Pending1; P3;
}
{
rank = same;
Pending2; Connected;
}
{
rank = same;
Pending2; P6;
}
Start -> Opened [ label = "open", dir = back ];
Opened -> P1 [ label = "connect", dir = back ];
P1 -> P2 [ label = "(success)", style = dotted ];
P1 -> Pending1 [ label = "(fail)", dir = back, style = dotted ];
Pending1 -> P3 [ label = "finishConnect", dir = back ];
P3 -> P4 [ label = "connect", style = dotted ];
P4 -> Pending1 [ label = "(fail)", style = dotted ];
P4 -> P2 [ label = "(success)", style = dotted ];
P2 -> P5 [ label = "getBoolean", style = dotted ];
P5 -> Pending2 [ label = "(false)", style = dotted ];
P5 -> Connected [ label = "(true)", style = dotted ];
Pending2 -> P6 [ label = "finishConnect", dir = back ];
P6 -> P7 [ label = "getBoolean", style = dotted ];
P7 -> Pending2 [ label = "(false)", style = dotted ];
P7 -> Connected [ label = "(true)", style = dotted ];
}
digraph Emulation {
graph [ label = "State Transitions of SocketChannel#connect (emulation)" ]
rankdir=LR;
size="8,5"
node [ shape = doublecircle ];
Start;
node [ shape = point ];
P1; P2; P3; P4; P5; P6; P7;
node [ shape = circle ];
Opened; Pending1; Connected; Pending2;
Pending1 [ label = "Pending\n (connected = f\n pending = t)" ];
Pending2 [ label = "Pending\n (connected = t\n pending = t)" ];
Connected [ label = "Connected\n (connected = t\n pending = f)" ];
{
rank = same;
Start; Pending1; P1; Opened;
}
{
rank = same;
Pending1; P3;
}
{
rank = same;
Pending2; Connected;
}
{
rank = same;
Pending2; P6;
}
Start [ color = red ]
Opened [ color = red ]
P1 [ color = red ]
P2 [ color = red ]
P5 [ color = red ]
Connected [ color = red ]
Start -> Opened [ label = "open" dir = back color = red ]
Opened -> P1 [ label = "connect" dir = back color = red ]
P1 -> P2 [ label = "(success)" style = dotted color = red ]
P1 -> Pending1 [ label = "(fail)" dir = back style = dotted ]
Pending1 -> P3 [ label = "finishConnect" dir = back ]
P3 -> P4 [ label = "connect" style = dotted ]
P4 -> Pending1 [ label = "(fail)" style = dotted ]
P4 -> P2 [ label = "(success)" style = dotted ]
P2 -> P5 [ label = "getBoolean" style = dotted color = red ]
P5 -> Pending2 [ label = "(false)" style = dotted ]
P5 -> Connected [ label = "(true)" style = dotted color = red ]
Pending2 -> P6 [ label = "finishConnect" dir = back ]
P6 -> P7 [ label = "getBoolean" style = dotted ]
P7 -> Pending2 [ label = "(false)" style = dotted ]
P7 -> Connected [ label = "(true)" style = dotted ]
}
digraph Emulation {
graph [ label = "State Transitions of SocketChannel#connect (emulation)" ]
rankdir=LR;
size="8,5"
node [ shape = doublecircle ];
Start;
node [ shape = point ];
P1; P2; P3; P4; P5; P6; P7;
node [ shape = circle ];
Opened; Pending1; Connected; Pending2;
Pending1 [ label = "Pending\n (connected = f\n pending = t)" ];
Pending2 [ label = "Pending\n (connected = t\n pending = t)" ];
Connected [ label = "Connected\n (connected = t\n pending = f)" ];
{
rank = same;
Start; Pending1; P1; Opened;
}
{
rank = same;
Pending1; P3;
}
{
rank = same;
Pending2; Connected;
}
{
rank = same;
Pending2; P6;
}
Start [ color = red ]
Opened [ color = red ]
P1 [ color = red ]
P2 [ color = red ]
P5 [ color = red ]
P6 [ color = red ]
P7 [ color = red ]
Pending2 [ color = red ]
Connected [ color = red ]
Start -> Opened [ label = "open" dir = back color = red ]
Opened -> P1 [ label = "connect" dir = back color = red ]
P1 -> P2 [ label = "(success)" style = dotted color = red ]
P1 -> Pending1 [ label = "(fail)" dir = back style = dotted ]
Pending1 -> P3 [ label = "finishConnect" dir = back ]
P3 -> P4 [ label = "connect" style = dotted ]
P4 -> Pending1 [ label = "(fail)" style = dotted ]
P4 -> P2 [ label = "(success)" style = dotted ]
P2 -> P5 [ label = "getBoolean" style = dotted color = red ]
P5 -> Pending2 [ label = "(false)" style = dotted color = red ]
P5 -> Connected [ label = "(true)" style = dotted ]
Pending2 -> P6 [ label = "finishConnect" dir = back color = red ]
P6 -> P7 [ label = "getBoolean" style = dotted color = red ]
P7 -> Pending2 [ label = "(false)" style = dotted ]
P7 -> Connected [ label = "(true)" style = dotted color = red ]
}
digraph Emulation {
graph [ label = "State Transitions of SocketChannel#connect (emulation)" ]
rankdir=LR;
size="8,5"
node [ shape = doublecircle ];
Start;
node [ shape = point ];
P1; P2; P3; P4; P5; P6; P7;
node [ shape = circle ];
Opened; Pending1; Connected; Pending2;
Pending1 [ label = "Pending\n (connected = f\n pending = t)" ];
Pending2 [ label = "Pending\n (connected = t\n pending = t)" ];
Connected [ label = "Connected\n (connected = t\n pending = f)" ];
{
rank = same;
Start; Pending1; P1; Opened;
}
{
rank = same;
Pending1; P3;
}
{
rank = same;
Pending2; Connected;
}
{
rank = same;
Pending2; P6;
}
Start [ color = red ]
Opened [ color = red ]
P1 [ color = red ]
P2 [ color = red ]
P5 [ color = red ]
P6 [ color = red ]
P7 [ color = red ]
Pending2 [ color = red ]
Connected [ color = red ]
Start -> Opened [ label = "open" dir = back color = red ]
Opened -> P1 [ label = "connect" dir = back color = red ]
P1 -> P2 [ label = "(success)" style = dotted color = red ]
P1 -> Pending1 [ label = "(fail)" dir = back style = dotted ]
Pending1 -> P3 [ label = "finishConnect" dir = back ]
P3 -> P4 [ label = "connect" style = dotted ]
P4 -> Pending1 [ label = "(fail)" style = dotted ]
P4 -> P2 [ label = "(success)" style = dotted ]
P2 -> P5 [ label = "getBoolean" style = dotted color = red ]
P5 -> Pending2 [ label = "(false)" style = dotted color = red ]
P5 -> Connected [ label = "(true)" style = dotted ]
Pending2 -> P6 [ label = "finishConnect" dir = back color = red ]
P6 -> P7 [ label = "getBoolean" style = dotted color = red ]
P7 -> Pending2 [ label = "(false)" style = dotted color = red ]
P7 -> Connected [ label = "(true)" style = dotted color = red ]
}
digraph Full {
graph [ label = "State Transitions of SocketChannel#connect (full)" ]
rankdir=LR;
size="8,5"
node [ shape = doublecircle ]; Start;
node [ shape = circle ];
Start;
Opened;
Pending;
Connected;
Closed;
Invalid;
Start -> Opened [ label = "open" ];
Opened -> Pending [ label = "connect" ];
Opened -> Connected [ label = "connect" ];
Pending -> Pending [ label = "finishConnect" ];
Pending -> Connected [ label = "finishConnect" ];
Connected -> Connected [ label = "read,write" ];
Connected -> Closed [ label = "close" ];
Start -> Invalid;
Opened -> Invalid;
Pending -> Invalid;
Connected -> Invalid;
Closed -> Invalid;
}
RM=rm -f
DOT=dot
GRAPHS=full.gv\
simplified.gv simplified_p1.gv simplified_p2.gv simplified_p3.gv\
emulation.gv emulation_p1.gv emulation_p2.gv emulation_p3.gv\
read.gv read_emulation.gv
PNGS=$(GRAPHS:.gv=.png)
EPSS=$(GRAPHS:.gv=.eps)
all: $(PNGS) $(EPSS)
.SUFFIXES:
.SUFFIXES: .gv .png .eps
.gv.png:
$(DOT) -T png -o $@ $<
.gv.eps:
$(DOT) -T eps -o $@ $<
.PHONY: clean
clean:
$(RM) *.png
digraph Read {
graph [ label = "State Transitions of SocketChannel#read" ]
rankdir=LR
size="8,5"
node [ shape = point ] End
node [ shape = circle ]
Connected1 [ label = "Connected" ]
Connected2 [ label = "Connected" ]
Connected3 [ label = "Connected" ]
Connected1 -> Connected1 [ label = "read 0 byte" ]
Connected1 -> Connected2 [ label = "read n bytes" ]
Connected2 -> Connected2 [ label = "read 0 byte" ]
Connected2 -> Connected3 [ label = "read n bytes" ]
Connected3 -> Connected3 [ label = "read 0 byte" ]
Connected3 -> End [ style = dotted ]
//Connected1 -> Closed
//Connected2 -> Closed
//Connected3 -> Closed
}
digraph Read {
graph [ label = "State Transitions of SocketChannel#read (emulation)" ]
rankdir=RL
size="8,5"
node [ shape = point ]
P1 P2 P3 P4
node [ shape = circle ]
Connected -> P1 [ label = getBoolean style = dotted ]
P1 -> P2 [ label = "(true)" style = dotted ]
P1 -> P3 [ label = "(false)" style = dotted ]
P3 -> Connected [ label = "read 0 byte" ]
P2 -> P4 [ label = "available" style = dotted]
P4 -> Connected [ label = "read n bytes" ]
P2 -> P3 [ label = "not available" style = dotted]
//P2 -> Closed [ label = "disconnected" ]
}
digraph Simplified {
graph [ label = "State Transitions of SocketChannel#connect (simplified)" ]
rankdir=LR;
size="8,5"
node [ shape = doublecircle ]; Start;
node [ shape = circle ];
Start;
Opened;
Pending;
Connected;
Start -> Opened [ label = "open" ];
Opened -> Pending [ label = "connect" ];
Opened -> Connected [ label = "connect" ];
Pending -> Pending [ label = "finishConnect" ];
Pending -> Connected [ label = "finishConnect" ];
}
digraph Simplified {
graph [ label = "State Transitions of SocketChannel#connect (simplified)" ]
rankdir=LR;
size="8,5"
node [ shape = doublecircle ]; Start;
node [ shape = circle ];
Start [ color = red ];
Opened [ color = red ];
Pending;
Connected [ color = red ];
Start -> Opened [ label = "open" color = red ];
Opened -> Pending [ label = "connect" ];
Opened -> Connected [ label = "connect" color = red ];
Pending -> Pending [ label = "finishConnect" ];
Pending -> Connected [ label = "finishConnect" ];
}
digraph Simplified {
graph [ label = "State Transitions of SocketChannel#connect (simplified)" ]
rankdir=LR;
size="8,5"
node [ shape = doublecircle ]; Start;
node [ shape = circle ];
Start [ color = red ];
Opened [ color = red ];
Pending [ color = red ];
Connected [ color = red ];
Start -> Opened [ label = "open" color = red ]
Opened -> Pending [ label = "connect" color = red ]
Opened -> Connected [ label = "connect" ]
Pending -> Pending [ label = "finishConnect" ]
Pending -> Connected [ label = "finishConnect" color = red ]
}
digraph Simplified {
graph [ label = "State Transitions of SocketChannel#connect (simplified)" ]
rankdir=LR;
size="8,5"
node [ shape = doublecircle ]; Start;
node [ shape = circle ];
Start [ color = red ];
Opened [ color = red ];
Pending [ color = red ];
Connected [ color = red ];
Start -> Opened [ label = "open" color = red ]
Opened -> Pending [ label = "connect" color = red ]
Opened -> Connected [ label = "connect" ]
Pending -> Pending [ label = "finishConnect" color = red ]
Pending -> Connected [ label = "finishConnect" color = red ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment