| 1 | package Statistics::R::REXP::Double; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: an R numeric vector | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 19 | $Statistics::R::REXP::Double::VERSION = '1.0002'; | |||||||||||||||||||||||||||||||||||||||||||||
| 4 | 19 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 19 | ▶ | use Scalar::Util qw(looks_like_number); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 19 | ▶ | use Class::Tiny::Antlers; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 19 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 19 | extends 'Statistics::R::REXP::Vector'; | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | 19 | ▶ | use overload; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 19 | ▶ | use constant sexptype => 'REALSXP'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 13 | ▶ | sub _type { 'double'; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_type: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 1671 | ▶ | sub BUILDARGS { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILDARGS: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 1671 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 22 | 1671 | my $attributes = $class->SUPER::BUILDARGS(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 1670 | ▶ | if (ref($attributes->{elements}) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | $attributes->{elements} = [ | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 7083 | ▶ | map { looks_like_number($_) ? $_ : undef } | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 1656 | Statistics::R::REXP::Vector::_flatten(@{$attributes->{elements}}) | |||||||||||||||||||||||||||||||||||||||||||||
| 28 | ] | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | $attributes | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 1670 | } | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 1667 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=4 SCAR=15.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 1667 | my ($self, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # Required attribute type | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | die "Elements of the 'elements' attribute must be numbers or undef" if defined($self->elements) && | ||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 1667 | ▶ | grep { defined($_) && !looks_like_number($_) } @{$self->elements} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
defined $self->elements and grep {defined $_ and not &looks_like_number($_);} @{$self->elements;}
defined $_ && !&looks_like_number($_)
MC/DC0%0/2
defined $self->elements and grep {defined $_ and not &looks_like_number($_);} @{$self->elements;}
defined $self->elements
grep {defined $_ and not &looks_like_number($_);} @{$self->elements;}
MC/DC0%0/2
defined $_ && !&looks_like_number($_)
defined $_
!&looks_like_number($_)
Truth table33%1/3
A and B
A= defined $self->elementsB= grep {defined $_ and not &looks_like_number($_);} @{$self->elements;}
Truth table66%2/3
A && not(B)
A= defined $_B= !&looks_like_number($_)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 19 | 1; # End of Statistics::R::REXP::Double | |||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||