line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Statistics::R::REXP::S4; |
2
|
|
|
|
|
|
|
# ABSTRACT: an R closure |
3
|
|
|
|
|
|
|
$Statistics::R::REXP::S4::VERSION = '1.0'; |
4
|
11
|
|
|
11
|
|
16732
|
use 5.010; |
|
11
|
|
|
|
|
23
|
|
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
|
39
|
use Scalar::Util qw(blessed); |
|
11
|
|
|
|
|
12
|
|
|
11
|
|
|
|
|
488
|
|
7
|
|
|
|
|
|
|
|
8
|
11
|
|
|
11
|
|
477
|
use Class::Tiny::Antlers qw(-default around); |
|
11
|
|
|
|
|
4218
|
|
|
11
|
|
|
|
|
51
|
|
9
|
11
|
|
|
11
|
|
1453
|
use namespace::clean; |
|
11
|
|
|
|
|
10746
|
|
|
11
|
|
|
|
|
47
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
extends 'Statistics::R::REXP'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
11
|
|
|
11
|
|
1403
|
use constant sexptype => 'S4SXP'; |
|
11
|
|
|
|
|
11
|
|
|
11
|
|
|
|
|
1039
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
has class => ( |
17
|
|
|
|
|
|
|
is => 'ro', |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
has 'package' => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
has slots => ( |
25
|
|
|
|
|
|
|
is => 'ro', |
26
|
|
|
|
|
|
|
default => sub { {} }, |
27
|
|
|
|
|
|
|
); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use overload |
30
|
11
|
|
|
11
|
|
1080
|
'""' => sub { shift->_to_s }; |
|
11
|
|
|
1
|
|
840
|
|
|
11
|
|
|
|
|
74
|
|
|
1
|
|
|
|
|
5
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub BUILD { |
33
|
42
|
|
|
42
|
0
|
799
|
my ($self, $args) = (shift, shift); |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Required attribute |
36
|
42
|
50
|
|
|
|
117
|
die "Attribute 'class' is required" unless defined $args->{class}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Required attribute type |
39
|
42
|
100
|
66
|
|
|
704
|
die "Attribute 'class' must be a scalar value" unless defined($self->class) && !ref($self->class); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
die "Attribute 'slots' must be a reference to a hash of REXPs or undefs" if ref($self->slots) ne 'HASH' || |
42
|
41
|
50
|
33
|
|
|
1481
|
grep { defined($_) && ! (blessed($_) && $_->isa('Statistics::R::REXP')) } values(%{$self->slots}); |
|
80
|
100
|
66
|
|
|
813
|
|
|
40
|
|
|
|
|
737
|
|
43
|
|
|
|
|
|
|
|
44
|
40
|
100
|
66
|
|
|
692
|
die "Attribute 'package' must be a scalar value" unless defined($self->package) && !ref($self->package); |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
around _eq => sub { |
48
|
|
|
|
|
|
|
my $orig = shift; |
49
|
|
|
|
|
|
|
return unless $orig->(@_); |
50
|
|
|
|
|
|
|
my ($self, $obj) = (shift, shift); |
51
|
|
|
|
|
|
|
Statistics::R::REXP::_compare_deeply($self->class, $obj->class) && |
52
|
|
|
|
|
|
|
Statistics::R::REXP::_compare_deeply($self->slots, $obj->slots) && |
53
|
|
|
|
|
|
|
Statistics::R::REXP::_compare_deeply($self->package, $obj->package) |
54
|
|
|
|
|
|
|
}; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
sub _to_s { |
57
|
1
|
|
|
1
|
|
2
|
my $self = shift; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
"object of class '" . $self->class . "' (package " . $self->package . ") with " . |
60
|
1
|
|
|
|
|
23
|
scalar(keys(%{$self->slots})) . " slots" |
|
1
|
|
|
|
|
35
|
|
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub to_pl { |
64
|
1
|
|
|
1
|
1
|
489
|
my $self = shift; |
65
|
|
|
|
|
|
|
|
66
|
1
|
|
|
|
|
23
|
{ class => $self->class, slots => $self->slots, package => $self->package } |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; # End of Statistics::R::REXP::S4 |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
__END__ |