line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# $Id: Traverse.pm,v 1.8 2006/05/06 18:56:21 gene Exp $ |
2
|
|
|
|
|
|
|
package GraphViz::Traverse; |
3
|
1
|
|
|
1
|
|
672
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
33
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
5
|
1
|
|
|
1
|
|
13
|
use base qw( GraphViz ); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
569
|
|
6
|
1
|
|
|
1
|
|
6
|
use Carp; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
641
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
8
|
|
|
|
|
|
|
our $AUTOLOAD; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
1
|
|
|
1
|
1
|
436
|
my( $proto, %args ) = @_; |
12
|
1
|
|
33
|
|
|
6
|
my $class = ref( $proto ) || $proto; |
13
|
1
|
|
|
|
|
17
|
my $self = $proto->SUPER::new( %args ); |
14
|
|
|
|
|
|
|
|
15
|
0
|
|
|
|
|
|
$self->{_DEBUG} = $args{_DEBUG}; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
$self->{_attributes} = { |
18
|
0
|
|
|
|
|
|
( map { 'node_' . $_ => undef } qw( |
19
|
|
|
|
|
|
|
color |
20
|
|
|
|
|
|
|
distortion |
21
|
|
|
|
|
|
|
fillcolor |
22
|
|
|
|
|
|
|
fixedsize |
23
|
|
|
|
|
|
|
fontcolor |
24
|
|
|
|
|
|
|
fontname |
25
|
|
|
|
|
|
|
fontsize |
26
|
|
|
|
|
|
|
height |
27
|
|
|
|
|
|
|
href |
28
|
|
|
|
|
|
|
label |
29
|
|
|
|
|
|
|
layer |
30
|
|
|
|
|
|
|
orientation |
31
|
|
|
|
|
|
|
peripheries |
32
|
|
|
|
|
|
|
regular |
33
|
|
|
|
|
|
|
shape |
34
|
|
|
|
|
|
|
sides |
35
|
|
|
|
|
|
|
skew |
36
|
|
|
|
|
|
|
style |
37
|
|
|
|
|
|
|
target |
38
|
|
|
|
|
|
|
tooltip |
39
|
|
|
|
|
|
|
URL |
40
|
|
|
|
|
|
|
width |
41
|
|
|
|
|
|
|
) ), |
42
|
0
|
|
|
|
|
|
( map { 'edge_' . $_ => undef } qw( |
43
|
|
|
|
|
|
|
arrowhead |
44
|
|
|
|
|
|
|
arrowsize |
45
|
|
|
|
|
|
|
arrowtail |
46
|
|
|
|
|
|
|
color |
47
|
|
|
|
|
|
|
constraint |
48
|
|
|
|
|
|
|
decorate |
49
|
|
|
|
|
|
|
dir |
50
|
|
|
|
|
|
|
fontcolor |
51
|
|
|
|
|
|
|
fontname |
52
|
|
|
|
|
|
|
fontsize |
53
|
|
|
|
|
|
|
headURL |
54
|
|
|
|
|
|
|
headclip |
55
|
|
|
|
|
|
|
headhref |
56
|
|
|
|
|
|
|
headlabel |
57
|
|
|
|
|
|
|
headtarget |
58
|
|
|
|
|
|
|
headtooltip |
59
|
|
|
|
|
|
|
href |
60
|
|
|
|
|
|
|
label |
61
|
|
|
|
|
|
|
labelangle |
62
|
|
|
|
|
|
|
labeldistance |
63
|
|
|
|
|
|
|
layer |
64
|
|
|
|
|
|
|
minlen |
65
|
|
|
|
|
|
|
port_label_distance |
66
|
|
|
|
|
|
|
samehead |
67
|
|
|
|
|
|
|
sametail |
68
|
|
|
|
|
|
|
style |
69
|
|
|
|
|
|
|
tailURL |
70
|
|
|
|
|
|
|
tailclip |
71
|
|
|
|
|
|
|
tailhref |
72
|
|
|
|
|
|
|
taillabel |
73
|
|
|
|
|
|
|
tailtooltip |
74
|
|
|
|
|
|
|
target |
75
|
|
|
|
|
|
|
tooltip |
76
|
|
|
|
|
|
|
URL |
77
|
|
|
|
|
|
|
weight |
78
|
|
|
|
|
|
|
) ) |
79
|
|
|
|
|
|
|
}; |
80
|
|
|
|
|
|
|
|
81
|
0
|
|
|
|
|
|
bless $self, $class; |
82
|
0
|
|
|
|
|
|
return $self; |
83
|
|
|
|
|
|
|
} |
84
|
|
|
|
|
|
|
|
85
|
0
|
|
|
0
|
|
|
sub DESTROY {} |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
sub AUTOLOAD { |
88
|
0
|
|
|
0
|
|
|
my $self = shift; |
89
|
0
|
|
0
|
|
|
|
my $type = ref( $self ) || croak "$self is not an object"; |
90
|
0
|
|
|
|
|
|
( my $method = $AUTOLOAD ) =~ s/.*://; |
91
|
0
|
|
|
|
|
|
my $superior = "SUPER::$method"; |
92
|
0
|
0
|
|
|
|
|
return exists $self->{_attributes}{$method} |
93
|
|
|
|
|
|
|
? undef : $self->$superior(@_); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
sub build_attributes { |
97
|
0
|
|
|
0
|
0
|
|
my( $self, $A, $B ) = @_; |
98
|
0
|
0
|
|
|
|
|
my $type = $B ? 'edge' : 'node'; |
99
|
0
|
|
|
|
|
|
my %attributes = (); |
100
|
0
|
|
|
|
|
|
for my $method ( keys %{ $self->{_attributes} } ) { |
|
0
|
|
|
|
|
|
|
101
|
0
|
0
|
|
|
|
|
$self->{_attributes}{$method} = $B |
102
|
|
|
|
|
|
|
? $self->$method( $A => $B ) |
103
|
|
|
|
|
|
|
: $self->$method( $A ); |
104
|
|
|
|
|
|
|
} |
105
|
0
|
|
|
|
|
|
return %{ $self->{_attributes} }; |
|
0
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
sub mark_item { |
109
|
0
|
|
|
0
|
1
|
|
my( $self, $node, $parent ) = @_; |
110
|
0
|
0
|
|
|
|
|
if( $parent ) { |
111
|
0
|
|
|
|
|
|
$self->add_edge( $parent => $node, |
112
|
|
|
|
|
|
|
$self->build_attributes( $node, $parent ) |
113
|
|
|
|
|
|
|
); |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
else { |
116
|
0
|
|
|
|
|
|
$self->add_node( $node, $self->build_attributes( $node ) ); |
117
|
|
|
|
|
|
|
} |
118
|
|
|
|
|
|
|
} |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
sub traverse { |
121
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
122
|
0
|
0
|
|
|
|
|
warn "traverse() must be overridden.\n" if $self->{_DEBUG}; |
123
|
0
|
|
|
|
|
|
return undef; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
1; |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
__END__ |