| 1 | package Statistics::R::REXP::List; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: an R generic vector (list) | ||||||||||||||||||||||||||||
| 3 | 24 | $Statistics::R::REXP::List::VERSION = '1.0002'; | |||||||||||||||||||||||||||
| 4 | 24 | ▶ | use 5.010; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 24 | ▶ | use Scalar::Util qw(blessed weaken); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 24 | ▶ | use Class::Tiny::Antlers; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 24 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 24 | extends 'Statistics::R::REXP::Vector'; | |||||||||||||||||||||||||||
| 12 | 24 | ▶ | use overload; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 24 | ▶ | use constant sexptype => 'VECSXP'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 151 | ▶ | sub _to_s { | ||||||||||||||||||||||||||
|
Subroutine
_to_s: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 18 | 151 | my $self = shift; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 151 | my ($u, $unfold); | |||||||||||||||||||||||||||
| 21 | 166 | ▶ | $u = $unfold = sub { | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||
| 22 | 166 | join(', ', map { ref $_ eq ref [] ? | |||||||||||||||||||||||||||
| 23 | 392 | ▶ | '[' . &$unfold(@{$_}) . ']' : | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 24 | (defined $_? $_ : 'undef') } @_); | ||||||||||||||||||||||||||||
| 25 | 151 | }; | |||||||||||||||||||||||||||
| 26 | 151 | weaken $unfold; | |||||||||||||||||||||||||||
| 27 | 151 | $self->_type . '(' . &$unfold(@{$self->elements}) . ')'; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 6 | ▶ | sub to_pl { | ||||||||||||||||||||||||||
|
Subroutine
to_pl: called CC=6 SCAR=18.2
Pod
documented
| |||||||||||||||||||||||||||||
| 32 | 6 | my $self = shift; | |||||||||||||||||||||||||||
| 33 | [ map { | ||||||||||||||||||||||||||||
| 34 | 16 | ▶ | if (blessed $_ && $_->can('to_pl')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
builtin::blessed($_) and $_->can("to_pl")
MC/DC50%1/2
builtin::blessed($_) and $_->can("to_pl")
builtin::blessed($_)
$_->can("to_pl")
Truth table66%2/3
A and B
A= builtin::blessed($_)B= $_->can("to_pl")
| |||||||||||||||||||||||||||||
| 35 | 6 | my $x = $_->to_pl; | |||||||||||||||||||||||||||
| 36 | 6 | ▶ | if (ref $x eq ref []) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 37 | 6 | ▶ | unless (scalar @{$x} > 1 || | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
scalar @{$x;} > 1 or $_->isa("Statistics::R::REXP::List")
MC/DC50%1/2
scalar @{$x;} > 1 or $_->isa("Statistics::R::REXP::List")
scalar @{$x;} > 1
$_->isa("Statistics::R::REXP::List")
Truth table66%2/3
A or B
A= scalar @{$x;} > 1B= $_->isa("Statistics::R::REXP::List")
| |||||||||||||||||||||||||||||
| 38 | $_->isa('Statistics::R::REXP::List')) { | ||||||||||||||||||||||||||||
| 39 | 4 | @{$x} | |||||||||||||||||||||||||||
| 40 | } else { | ||||||||||||||||||||||||||||
| 41 | 2 | $x | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | } else { | ||||||||||||||||||||||||||||
| 44 | 0 | $x | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | } else { | ||||||||||||||||||||||||||||
| 47 | 10 | $_ | |||||||||||||||||||||||||||
| 48 | } | ||||||||||||||||||||||||||||
| 49 | 6 | } @{$self->elements} ] | |||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | 122 | ▶ | sub _type { 'list'; } | ||||||||||||||||||||||||||
|
Subroutine
_type: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 24 | 1; # End of Statistics::R::REXP::List | |||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | __END__ | ||||||||||||||||||||||||||||