line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Data::Classifier::Result; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
6
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
699
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
#private interface |
9
|
|
|
|
|
|
|
sub new { |
10
|
3
|
|
|
3
|
0
|
9
|
my ($class, $stack) = @_; |
11
|
3
|
|
|
|
|
14
|
my $self = {}; |
12
|
|
|
|
|
|
|
|
13
|
3
|
|
|
|
|
7
|
bless($self, $class); |
14
|
|
|
|
|
|
|
|
15
|
3
|
|
|
|
|
9
|
$self->{STACK} = $stack; |
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
|
|
7
|
$self->init; |
18
|
|
|
|
|
|
|
|
19
|
3
|
|
|
|
|
8
|
return $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
#this method is intended to be overloaded by subclasses to further customize |
23
|
|
|
|
|
|
|
#the behavior of the classification, such as insctructions to execute at class |
24
|
|
|
|
|
|
|
#boundries |
25
|
|
|
|
|
|
|
sub init { |
26
|
3
|
|
|
3
|
1
|
3
|
return; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#public interface |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
#returns the most specific class node that matched or undef if no |
32
|
|
|
|
|
|
|
#classification was possible |
33
|
|
|
|
|
|
|
sub class { |
34
|
5
|
|
|
5
|
1
|
10
|
my ($self) = @_; |
35
|
5
|
|
|
|
|
11
|
my @stack = $self->stack; |
36
|
5
|
|
|
|
|
7
|
my $last = $#stack; |
37
|
|
|
|
|
|
|
|
38
|
5
|
|
|
|
|
19
|
return $stack[$last]; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub stack { |
42
|
8
|
|
|
8
|
1
|
9
|
my ($self) = @_; |
43
|
|
|
|
|
|
|
|
44
|
8
|
|
|
|
|
8
|
return @{$self->{STACK}}; |
|
8
|
|
|
|
|
25
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub fqn { |
48
|
0
|
|
|
0
|
1
|
0
|
my ($self) = @_; |
49
|
0
|
|
|
|
|
0
|
my $classes = $self->{STACK}; |
50
|
0
|
|
|
|
|
0
|
my @tmp; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
0
|
foreach my $class (@$classes) { |
53
|
0
|
|
|
|
|
0
|
push(@tmp, $class->{name}); |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
0
|
return join('::', @tmp); |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
#returns the most specific class name |
60
|
|
|
|
|
|
|
sub name { |
61
|
2
|
|
|
2
|
1
|
3
|
my ($self) = @_; |
62
|
2
|
|
|
|
|
4
|
my $class = $self->class; |
63
|
|
|
|
|
|
|
|
64
|
2
|
|
|
|
|
8
|
return $class->{name}; |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
#return a list of data attributes |
68
|
|
|
|
|
|
|
sub attributes { |
69
|
0
|
|
|
0
|
1
|
|
my ($self, $attribute) = @_; |
70
|
0
|
|
|
|
|
|
my @ret; |
71
|
|
|
|
|
|
|
|
72
|
0
|
|
|
|
|
|
foreach ($self->stack) { |
73
|
0
|
|
|
|
|
|
push(@ret, $_->{$attribute}); |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
|
|
|
return @ret; |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |