line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Tree::Visualize::ASCII::Layouts::Binary::Diagonal; |
3
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
2557
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
62
|
|
5
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
46
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
10
|
use Tree::Visualize::Exceptions; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
33
|
|
8
|
2
|
|
|
2
|
|
513
|
use Tree::Visualize::ASCII::BoundingBox; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
44
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
471
|
use Tree::Visualize::Node::Factory; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
49
|
|
11
|
2
|
|
|
2
|
|
1188
|
use Tree::Visualize::Connector::Factory; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
84
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
11
|
use base qw(Tree::Visualize::ASCII::Layouts::Binary); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
900
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub drawNode { |
18
|
15
|
|
|
15
|
1
|
16
|
my ($self, $tree) = @_; |
19
|
15
|
|
|
|
|
69
|
my $node = Tree::Visualize::Node::Factory->new()->get(output => 'ASCII', node_type => 'Parens', args => [ $tree ]); |
20
|
15
|
|
|
|
|
100
|
return Tree::Visualize::ASCII::BoundingBox->new($node->draw()); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub drawConnections { |
24
|
15
|
|
|
15
|
1
|
18
|
my ($self, $current, $left, $right) = @_; |
25
|
|
|
|
|
|
|
# prepare the connections |
26
|
15
|
|
|
|
|
14
|
my ($left_connection, $right_connection) = (undef, undef); |
27
|
15
|
|
|
|
|
57
|
my $conn_factory = Tree::Visualize::Connector::Factory->new(); |
28
|
|
|
|
|
|
|
# get the left connection if we need it |
29
|
15
|
100
|
|
|
|
45
|
$left_connection = $conn_factory->get( |
30
|
|
|
|
|
|
|
output => 'ASCII', |
31
|
|
|
|
|
|
|
layout => 'Diagonal', |
32
|
|
|
|
|
|
|
connector_type => 'LeftRightConnector' |
33
|
|
|
|
|
|
|
)->drawLeftConnector($current, $left, $right) |
34
|
|
|
|
|
|
|
if defined $left; |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# get the right connection if we need it |
37
|
15
|
100
|
|
|
|
55
|
$right_connection = $conn_factory->get( |
38
|
|
|
|
|
|
|
output => 'ASCII', |
39
|
|
|
|
|
|
|
layout => 'Diagonal', |
40
|
|
|
|
|
|
|
connector_type => 'LeftRightConnector' |
41
|
|
|
|
|
|
|
)->drawRightConnector($current, $right, $left) |
42
|
|
|
|
|
|
|
if defined $right; |
43
|
|
|
|
|
|
|
# return our connections |
44
|
15
|
|
|
|
|
99
|
return ($left_connection, $right_connection); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub assembleDrawing { |
48
|
15
|
|
|
15
|
1
|
17
|
my ($self, $current, $children, $connections) = @_; |
49
|
|
|
|
|
|
|
|
50
|
15
|
|
|
|
|
13
|
my ($left, $right) = @{$children}; |
|
15
|
|
|
|
|
19
|
|
51
|
15
|
|
|
|
|
15
|
my ($left_connection, $right_connection) = @{$connections}; |
|
15
|
|
|
|
|
16
|
|
52
|
|
|
|
|
|
|
|
53
|
15
|
100
|
|
|
|
35
|
if (defined($right)) { |
54
|
7
|
|
|
|
|
18
|
$current->pasteRight($right_connection); |
55
|
|
|
|
|
|
|
} |
56
|
15
|
100
|
|
|
|
23
|
if (defined($left)) { |
57
|
7
|
|
|
|
|
19
|
$current->pasteBottom($left_connection) |
58
|
|
|
|
|
|
|
->pasteBottom($left); |
59
|
|
|
|
|
|
|
} |
60
|
15
|
100
|
|
|
|
28
|
if (defined($right)) { |
61
|
7
|
|
|
|
|
27
|
$current->pasteRight($right); |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
15
|
|
|
|
|
66
|
return $current; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
__END__ |