line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Tree::Binary::Visitor::Base; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
59347
|
use strict; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
127
|
|
4
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
1474
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.09'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
### constructor |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
11
|
213
|
|
|
213
|
1
|
6902
|
my ($_class) = @_; |
12
|
213
|
|
33
|
|
|
757
|
my $class = ref($_class) || $_class; |
13
|
213
|
|
|
|
|
336
|
my $visitor = {}; |
14
|
213
|
|
|
|
|
364
|
bless($visitor, $class); |
15
|
213
|
|
|
|
|
574
|
$visitor->_init(); |
16
|
213
|
|
|
|
|
550
|
return $visitor; |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
### methods |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _init { |
22
|
213
|
|
|
213
|
|
344
|
my ($self) = @_; |
23
|
213
|
|
|
|
|
463
|
$self->{_filter_function} = undef; |
24
|
213
|
|
|
|
|
414
|
$self->{_results} = []; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# node filter methods |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub getNodeFilter { |
30
|
5
|
|
|
5
|
1
|
13
|
my ($self) = @_; |
31
|
5
|
|
|
|
|
15
|
return $self->{_filter_function}; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub clearNodeFilter { |
35
|
1
|
|
|
1
|
1
|
446
|
my ($self) = @_; |
36
|
1
|
|
|
|
|
3
|
$self->{_filter_function} = undef; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub setNodeFilter { |
40
|
8
|
|
|
8
|
1
|
4081
|
my ($self, $filter_function) = @_; |
41
|
8
|
100
|
100
|
|
|
53
|
(defined($filter_function) && ref($filter_function) eq "CODE") |
42
|
|
|
|
|
|
|
|| die "Insufficient Arguments : filter function argument must be a subroutine reference"; |
43
|
5
|
|
|
|
|
10
|
$self->{_filter_function} = $filter_function; |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# results methods |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub setResults { |
49
|
210
|
|
|
210
|
1
|
862
|
my ($self, @results) = @_; |
50
|
210
|
|
|
|
|
1563
|
$self->{results} = \@results; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub getResults { |
54
|
210
|
|
|
210
|
1
|
1858
|
my ($self) = @_; |
55
|
|
|
|
|
|
|
return wantarray ? |
56
|
206
|
|
|
|
|
783
|
@{$self->{results}} |
57
|
|
|
|
|
|
|
: |
58
|
210
|
100
|
|
|
|
430
|
$self->{results}; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# abstract method |
63
|
1
|
|
|
1
|
1
|
606
|
sub visit { die "Method Not Implemented" } |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
1; |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
__END__ |