line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package GraphViz::Graph::Node; |
2
|
|
|
|
|
|
|
|
3
|
8
|
|
|
8
|
|
64
|
use warnings; |
|
8
|
|
|
|
|
25
|
|
|
8
|
|
|
|
|
323
|
|
4
|
8
|
|
|
8
|
|
70
|
use strict; |
|
8
|
|
|
|
|
25
|
|
|
8
|
|
|
|
|
228
|
|
5
|
8
|
|
|
8
|
|
163
|
use 5.10.0; # state |
|
8
|
|
|
|
|
38
|
|
6
|
8
|
|
|
8
|
|
53
|
use Carp; |
|
8
|
|
|
|
|
22
|
|
|
8
|
|
|
|
|
3343
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
#_{ Methods |
10
|
|
|
|
|
|
|
#_{ POD |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=encoding utf8 |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 METHODS |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=cut |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
#_} |
19
|
|
|
|
|
|
|
sub new { #_{ |
20
|
|
|
|
|
|
|
#_{ POD |
21
|
|
|
|
|
|
|
=head2 new |
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
#_} |
24
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
25
|
0
|
|
|
|
|
|
my $opts = shift; |
26
|
0
|
|
|
|
|
|
my $self = {}; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# croak 'Options expected' unless defined $opts; |
30
|
|
|
|
|
|
|
# croak 'Options must be a HASH' unless ref $opts eq 'HASH'; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# croak "Unrecognized opts " . join "/", keys %$opts if keys %$opts; |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
state $id = 0; |
35
|
0
|
|
|
|
|
|
$self->{id} = sprintf('nd_%04d', ++$id); |
36
|
0
|
|
|
|
|
|
$self->{shape} = 'none'; |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
bless $self, $class; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
$self->shape('none'); |
41
|
0
|
|
|
|
|
|
return $self; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
} #_} |
44
|
|
|
|
|
|
|
sub label { #_{ |
45
|
|
|
|
|
|
|
#_{ POD |
46
|
|
|
|
|
|
|
=head2 label |
47
|
|
|
|
|
|
|
=cut |
48
|
|
|
|
|
|
|
#_} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
51
|
0
|
|
|
|
|
|
my $opts = shift; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
$self->{label} = GraphViz::Graph::Label->new($opts); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
} #_} |
56
|
|
|
|
|
|
|
sub shape { #_{ |
57
|
|
|
|
|
|
|
#_{ POD |
58
|
|
|
|
|
|
|
=head2 shape |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
Sets the shape of node. Possible values can be, among others: |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=over 4 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=item * C<'none'> |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=item * C<'point'> |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=item * C<'rect'> |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=item * C<'square'> |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=item * C<'star'> |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item * etc … |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=back |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |
79
|
|
|
|
|
|
|
#_} |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
82
|
0
|
|
|
|
|
|
my $shape_text = shift; # none, point, rect, square, star etc // TODO: record |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
$self->{shape_text} = $shape_text; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
return $self; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
} #_} |
89
|
|
|
|
|
|
|
sub dot_text { #_{ |
90
|
|
|
|
|
|
|
#_{ POD |
91
|
|
|
|
|
|
|
=head2 dot_text |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Returns the dot-text that represents the node on which it was called. |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Called by L's C. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=cut |
98
|
|
|
|
|
|
|
#_} |
99
|
|
|
|
|
|
|
|
100
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
101
|
|
|
|
|
|
|
|
102
|
0
|
|
|
|
|
|
my $ret = " $self->{id} [\n"; |
103
|
0
|
|
|
|
|
|
$ret .= " shape=" . $self->{shape_text} . "\n"; |
104
|
|
|
|
|
|
|
|
105
|
0
|
0
|
|
|
|
|
if (exists $self->{label}) { |
106
|
0
|
|
|
|
|
|
$ret .= " " . $self->{label}->dot_text(); |
107
|
|
|
|
|
|
|
} |
108
|
0
|
|
|
|
|
|
$ret .= " ];\n\n"; |
109
|
0
|
|
|
|
|
|
return $ret; |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
} #_} |
112
|
|
|
|
|
|
|
sub port { #_{ |
113
|
|
|
|
|
|
|
#_{ POD |
114
|
|
|
|
|
|
|
=head2 port |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
C<< $node->port() >> is needed to connect from or to ports with edges. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
my $nd_one = $graph->node(); |
119
|
|
|
|
|
|
|
my $nd_two = $graph->node(); |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
$nd_two->label({html=>""}); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
$graph->edge($nd_one, $nd_two->port('port_f')): |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=cut |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
#_} |
130
|
|
|
|
|
|
|
|
131
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
132
|
0
|
|
|
|
|
|
my $port_id = shift; |
133
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
return $self->{id} . ":$port_id"; |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
} #_} |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
#_} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
'tq84'; |