| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Tree::Visualize::ASCII::Connectors::TopDown::LeftRightConnector; |
|
3
|
|
|
|
|
|
|
|
|
4
|
2
|
|
|
2
|
|
1529
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
72
|
|
|
5
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
91
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
11
|
use base qw(Tree::Visualize::Connector::IConnector); |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
1202
|
|
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub drawLeftConnector { |
|
12
|
7
|
|
|
7
|
1
|
10
|
my ($self, $to, $from) = @_; |
|
13
|
|
|
|
|
|
|
# check the args first |
|
14
|
7
|
|
|
|
|
21
|
$self->checkArgs($to, $from); |
|
15
|
|
|
|
|
|
|
# get the left index of the TOP CORNER, then the right |
|
16
|
|
|
|
|
|
|
# index of the TOP CORNER, divide this by two and you |
|
17
|
|
|
|
|
|
|
# have found the middle of the top-most left node, which |
|
18
|
|
|
|
|
|
|
# is where you want to attach your connector. |
|
19
|
|
|
|
|
|
|
#....V |
|
20
|
|
|
|
|
|
|
# (node0) |
|
21
|
|
|
|
|
|
|
# (node1) |
|
22
|
|
|
|
|
|
|
# |
|
23
|
7
|
|
|
|
|
20
|
my $left_index = $from->getFirstConnectionPointIndex(); |
|
24
|
|
|
|
|
|
|
# now we need to calculate the renaming left |
|
25
|
|
|
|
|
|
|
# space between the center of the topmost left |
|
26
|
|
|
|
|
|
|
# box (where are attaching our connector) and |
|
27
|
|
|
|
|
|
|
# the the place where the new node we are connecting |
|
28
|
|
|
|
|
|
|
# to will be. |
|
29
|
|
|
|
|
|
|
# V..V |
|
30
|
|
|
|
|
|
|
# (node0) |
|
31
|
|
|
|
|
|
|
# (node1) |
|
32
|
|
|
|
|
|
|
# |
|
33
|
7
|
|
|
|
|
20
|
my $left_line_length = $from->width() - $left_index; |
|
34
|
|
|
|
|
|
|
# we then add the connectors to the current node |
|
35
|
|
|
|
|
|
|
# +---(node0) |
|
36
|
|
|
|
|
|
|
# (node1) |
|
37
|
|
|
|
|
|
|
# |
|
38
|
|
|
|
|
|
|
# NOTE: |
|
39
|
|
|
|
|
|
|
# this part is kind of a hack, becuase |
|
40
|
|
|
|
|
|
|
# it assumed a box which is 3 lines tall |
|
41
|
|
|
|
|
|
|
# this should be changed to accomadate other |
|
42
|
|
|
|
|
|
|
# size boxes. |
|
43
|
7
|
|
|
|
|
37
|
my $left_arm = Tree::Visualize::ASCII::BoundingBox->new( |
|
44
|
|
|
|
|
|
|
(" " x $left_line_length) . "\n" . |
|
45
|
|
|
|
|
|
|
("+" . ("-" x ($left_line_length - 1))) . "\n" . |
|
46
|
|
|
|
|
|
|
("|" . (" " x ($left_line_length - 1))) |
|
47
|
|
|
|
|
|
|
); |
|
48
|
|
|
|
|
|
|
# add padding to the left arm |
|
49
|
7
|
|
|
|
|
28
|
return $left_arm->padLeft(" " x $left_index); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub drawRightConnector { |
|
53
|
7
|
|
|
7
|
1
|
9
|
my ($self, $to, $from) = @_; |
|
54
|
|
|
|
|
|
|
# check the args first |
|
55
|
7
|
|
|
|
|
17
|
$self->checkArgs($to, $from); |
|
56
|
|
|
|
|
|
|
# get the first instance of TOPCORNER which |
|
57
|
|
|
|
|
|
|
# is the begining of the topmost box, then |
|
58
|
|
|
|
|
|
|
# get the last instance of it which is the |
|
59
|
|
|
|
|
|
|
# end of that same box. Then divide by two |
|
60
|
|
|
|
|
|
|
# to get the middle, which is where we want |
|
61
|
|
|
|
|
|
|
# the connector to go. |
|
62
|
|
|
|
|
|
|
# ...V |
|
63
|
|
|
|
|
|
|
# (node0) |
|
64
|
|
|
|
|
|
|
# (node2) |
|
65
|
|
|
|
|
|
|
# |
|
66
|
7
|
|
|
|
|
21
|
my $right_index = $from->getFirstConnectionPointIndex(); |
|
67
|
|
|
|
|
|
|
# Now add the connectors to the current node |
|
68
|
|
|
|
|
|
|
# (node0)---+ |
|
69
|
|
|
|
|
|
|
# (node2) |
|
70
|
|
|
|
|
|
|
# |
|
71
|
|
|
|
|
|
|
# NOTE: |
|
72
|
|
|
|
|
|
|
# this part is kind of a hack, becuase |
|
73
|
|
|
|
|
|
|
# it assumed a box which is 3 lines tall |
|
74
|
|
|
|
|
|
|
# this should be changed to accomadate other |
|
75
|
|
|
|
|
|
|
# size boxes. |
|
76
|
7
|
|
|
|
|
37
|
my $right_arm = Tree::Visualize::ASCII::BoundingBox->new( |
|
77
|
|
|
|
|
|
|
(" " x ($right_index + 1)) . "\n" . |
|
78
|
|
|
|
|
|
|
("-" x ($right_index)) . "+" . "\n" . |
|
79
|
|
|
|
|
|
|
(" " x $right_index) . "|" |
|
80
|
|
|
|
|
|
|
); |
|
81
|
|
|
|
|
|
|
# combine the current box with the right arm |
|
82
|
7
|
|
|
|
|
18
|
return $right_arm->padRight(" " x ($from->width() - $right_index)); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
__END__ |