line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Tree::Binary::Visitor::Base; |
3
|
|
|
|
|
|
|
|
4
|
5
|
|
|
5
|
|
15386
|
use strict; |
|
5
|
|
|
|
|
6
|
|
|
5
|
|
|
|
|
106
|
|
5
|
5
|
|
|
5
|
|
13
|
use warnings; |
|
5
|
|
|
|
|
3
|
|
|
5
|
|
|
|
|
1209
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '1.07'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
### constructor |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub new { |
12
|
213
|
|
|
213
|
1
|
5214
|
my ($_class) = @_; |
13
|
213
|
|
33
|
|
|
667
|
my $class = ref($_class) || $_class; |
14
|
213
|
|
|
|
|
353
|
my $visitor = {}; |
15
|
213
|
|
|
|
|
265
|
bless($visitor, $class); |
16
|
213
|
|
|
|
|
350
|
$visitor->_init(); |
17
|
213
|
|
|
|
|
390
|
return $visitor; |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
### methods |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _init { |
23
|
213
|
|
|
213
|
|
164
|
my ($self) = @_; |
24
|
213
|
|
|
|
|
317
|
$self->{_filter_function} = undef; |
25
|
213
|
|
|
|
|
321
|
$self->{_results} = []; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# node filter methods |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub getNodeFilter { |
31
|
5
|
|
|
5
|
1
|
9
|
my ($self) = @_; |
32
|
5
|
|
|
|
|
13
|
return $self->{_filter_function}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub clearNodeFilter { |
36
|
1
|
|
|
1
|
1
|
339
|
my ($self) = @_; |
37
|
1
|
|
|
|
|
3
|
$self->{_filter_function} = undef; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub setNodeFilter { |
41
|
8
|
|
|
8
|
1
|
3779
|
my ($self, $filter_function) = @_; |
42
|
8
|
100
|
100
|
|
|
67
|
(defined($filter_function) && ref($filter_function) eq "CODE") |
43
|
|
|
|
|
|
|
|| die "Insufficient Arguments : filter function argument must be a subroutine reference"; |
44
|
5
|
|
|
|
|
15
|
$self->{_filter_function} = $filter_function; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
# results methods |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub setResults { |
50
|
210
|
|
|
210
|
1
|
615
|
my ($self, @results) = @_; |
51
|
210
|
|
|
|
|
1189
|
$self->{results} = \@results; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub getResults { |
55
|
210
|
|
|
210
|
1
|
1330
|
my ($self) = @_; |
56
|
|
|
|
|
|
|
return wantarray ? |
57
|
206
|
|
|
|
|
913
|
@{$self->{results}} |
58
|
|
|
|
|
|
|
: |
59
|
210
|
100
|
|
|
|
313
|
$self->{results}; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# abstract method |
64
|
1
|
|
|
1
|
1
|
673
|
sub visit { die "Method Not Implemented" } |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |