基本的な処理パターンの絵
Catyのコマンド/アクション、クライアント状態(≒画面、UI)、型チェックと分岐、ファシリティ/エンティティなどを使って、基本的な処理パターンを表現してみる。







以下に描画用のソース。
// -*- coding: utf-8 -*-
/** ロバストネス風の図 */
module g;
command output-all :: void -> void {
req-c | gv:draw --out=/req-c.gif;
res-c | gv:draw --out=/res-c.gif;
vali-c | gv:draw --out=/vali-c.gif;
load-c | gv:draw --out=/load-c.gif;
save-c | gv:draw --out=/save-c.gif;
func-c | gv:draw --out=/func-c.gif;
send-c | gv:draw --out=/send-c.gif
};
command show-all :: void -> void {
file:read /req-c.gif | ct:show-image;
file:read /res-c.gif | ct:show-image;
file:read /vali-c.gif | ct:show-image;
file:read /load-c.gif | ct:show-image;
file:read /save-c.gif | ct:show-image;
file:read /func-c.gif | ct:show-image;
file:read /send-c.gif | ct:show-image
};
/** Request */
command req-c :: void -> gv:Digraph {
[
state-node input,
action-node command,
req-edge input command
] | gv:graph --rankdir=LR Request
};
/** Response */
command res-c :: void -> gv:Digraph {
[
state-node output,
action-node command,
res-edge command output
] | gv:graph --rankdir=RL Response
};
/** Validation */
command vali-c :: void -> gv:Digraph {
[
gv:node --shape=point --style=invis vin,
gv:node --shape=point --style=invis vout1,
gv:node --shape=point --style=invis vout2,
case-node type-check,
gv:edge --label="" vin type-check,
gv:edge --label=OK type-check vout1,
gv:edge --label=NG type-check vout2,
] | gv:graph --rankdir=LR Validation
};
/** Load */
command load-c :: void -> gv:Digraph {
[
action-node command,
entity-node store,
reads-edge command store
] | gv:graph Load
};
/** Save */
command save-c :: void -> gv:Digraph {
[
action-node command,
entity-node store,
updates-edge command store
] | gv:graph Save
};
/** Function */
command func-c :: void -> gv:Digraph {
[
action-node command,
] | gv:graph Function
};
/** Send */
command send-c :: void -> gv:Digraph {
[
state-node input,
action-node command,
port-node port,
req-edge input port,
req-edge command port
] | gv:graph Send
};
/* 基本図形 */
command case-node [string name] :: void -> gv:Node {
gv:node
--fontsize=14.0
--shape=diamond
--style=filled
--color=black
--fillcolor=darkseagreen2
%1
};
command state-node [string name] :: void -> gv:Node {
gv:node
--fontsize=14.0
--shape=note
--style=filled
--color=black
--fillcolor=gold
%1
};
command port-node [string name] :: void -> gv:Node {
gv:node
--fontsize=14.0
--shape=ellipse
--style="filled,dotted"
--color=black
--fillcolor=darkseagreen2
%1
};
command action-node [string name] :: void -> gv:Node {
gv:node
--fontsize=14.0
--shape=ellipse
--style=filled
--color=black
--fillcolor=darkseagreen2
%1
};
command entity-node [string name] :: void -> gv:Node {
gv:node
--fontsize=14.0
--shape=Mcircle
--style=filled
--color=black
--fillcolor=darkorange3
%1
};
command req-edge [string st, string ac] :: void -> gv:Edge {
gv:edge
--fontsize=14.0
--color=darkorchid3
%1 %2
};
command res-edge [string ac, string st] :: void -> gv:Edge {
gv:edge
--fontsize=14.0
--color=crimson
%1 %2
};
/* 以下、エッジの指定順序は、常に アクション エンティティ の順 */
command reads-edge [string act, string ent] :: void -> gv:Edge {
gv:edge
--dir=back
--label=reads
%1 %2
};
command updates-edge [string act, string ent] :: void -> gv:Edge {
gv:edge
--label=updates
%1 %2
};
command uses-edge [string act, string ent] :: void -> gv:Edge {
gv:edge
--dir=both
--label=updates
%1 %2
};
/* サンプル */
command sample :: void -> gv:Digraph {
[
action-node act1,
action-node act2,
action-node act3,
entity-node ent1,
entity-node ent2,
uses-edge act1 ent1,
reads-edge act2 ent1,
updates-edge act2 ent2,
reads-edge act3 ent2,
] | gv:graph sample
};
command sample2 :: void -> gv:Digraph {
[
action-node Data.get,
action-node Data.put,
action-node Data.index,
entity-node "mafs\npub",
entity-node "kvs\nindex",
reads-edge Data.get "mafs\npub",
updates-edge Data.put "mafs\npub",
updates-edge Data.put "kvs\nindex",
reads-edge Data.index "kvs\nindex",
] | gv:graph sample2
};
// End of Module