| 1 | package Statistics::R::REXP::Raw; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: an R raw vector | ||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 14 | $Statistics::R::REXP::Raw::VERSION = '1.0002'; | |||||||||||||||||||||||||||||||||||||||||||||
| 4 | 14 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 14 | ▶ | use Scalar::Util qw(looks_like_number); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 14 | ▶ | use Class::Tiny::Antlers; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 9 | 14 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 14 | extends 'Statistics::R::REXP::Vector'; | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | 14 | ▶ | use overload; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 14 | ▶ | use constant sexptype => 'RAWSXP'; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | sub _type { 'raw'; } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_type: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 90 | ▶ | sub BUILDARGS { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILDARGS: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 90 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 22 | 90 | my $attributes = $class->SUPER::BUILDARGS(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 89 | ▶ | if (ref($attributes->{elements}) eq 'ARRAY') { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 25 | $attributes->{elements} = [ | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | map int, | ||||||||||||||||||||||||||||||||||||||||||||||
| 27 | 75 | Statistics::R::REXP::Vector::_flatten(@{$attributes->{elements}}) | |||||||||||||||||||||||||||||||||||||||||||||
| 28 | ] | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | $attributes | ||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 89 | } | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 87 | ▶ | sub BUILD { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: called CC=5 SCAR=16.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 87 | my ($self, $args) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||
| 37 | # Required attribute type | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 87 | ▶ | die 'Raw vectors cannot have attributes' if defined $self->attributes; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | die 'Elements of raw vectors must be 0-255' if defined $self->elements && | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 86 | ▶ | grep { !($_ >= 0 && $_ <= 255) } @{$self->elements} | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
defined $self->elements and grep {not $_ >= 0 && $_ <= 255;} @{$self->elements;}
$_ >= 0 && $_ <= 255
MC/DC50%1/2
defined $self->elements and grep {not $_ >= 0 && $_ <= 255;} @{$self->elements;}
defined $self->elements
grep {not $_ >= 0 && $_ <= 255;} @{$self->elements;}
MC/DC50%1/2
$_ >= 0 && $_ <= 255
$_ >= 0
$_ <= 255
Truth table66%2/3
A and B
A= defined $self->elementsB= grep {not $_ >= 0 && $_ <= 255;} @{$self->elements;}
Truth table66%2/3
A && B
A= $_ >= 0B= $_ <= 255
| |||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 14 | 1; # End of Statistics::R::REXP::Raw | |||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||