forked from creationix/howtonode.org
/
prototypal.dot
44 lines (36 loc) · 1.83 KB
/
prototypal.dot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
digraph finite_state_machine {
size="8.3,5"
rankdir = "LR"
node [fontname=Sans]
/* Execution Contexts */
node [shape=Mrecord, fillcolor=beige, style=filled];
top [label="<__proto__>[ Scope ]|<Rectangle>Rectangle|<rect>rect|<Square>Square|<sqr>sqr"];
/* Normal Objects */
node [shape = Mrecord, fillcolor=lightskyblue, style=filled];
ob_Rectangle [label = "<__proto__>[ Object ]|<name>name=\"Rectangle\"|<getArea>getArea|<getPerimeter>getPerimeter|<toString>toString"];
ob_Square [label = "<__proto__>[ Object ]|<name>name=\"Square\"|<getArea>getArea|<getPerimeter>getPerimeter"];
ob_rect [label = "<__proto__>[ Object ]|<width>width=6|<height>height=4"];
ob_sqr [label = "<__proto__>[ Object ]|<width>width=5"];
/* Function Objects */
node [shape = Mrecord, fillcolor=orange, style=filled];
fn_getArea [label="<__proto__>[getArea()]|\{return this.width * this.height\}"];
fn_getPerimeter [label="<__proto__>[getPerimeter()]|\{return 2 * (this.width + this.height)\}"];
fn_toString [label="<__proto__>[toString()]|\{return this.name + \" a=\" + …\}"];
fn_getArea2 [label="<__proto__>[getArea()]|\{return this.width * this.width\}"];
fn_getPerimeter2 [label="<__proto__>[getPerimeter()]|\{return 4 * this.width\}"];
/* References */
top:Rectangle -> ob_Rectangle:__proto__;
top:Square -> ob_Square:__proto__;
top:rect -> ob_rect:__proto__;
top:sqr -> ob_sqr:__proto__;
ob_Rectangle:getArea -> fn_getArea:__proto__;
ob_Rectangle:getPerimeter -> fn_getPerimeter:__proto__;
ob_Rectangle:toString -> fn_toString:__proto__;
ob_Square:getArea -> fn_getArea2:__proto__;
ob_Square:getPerimeter -> fn_getPerimeter2:__proto__;
/* Inheritance Chains */
edge [style=dashed]
ob_rect:__proto__ -> ob_Rectangle:__proto__;
ob_sqr:__proto__ -> ob_Square:__proto__;
ob_Square:__proto__ -> ob_Rectangle:__proto__;
}