Data/Frame/Indexer.pm

filter: Statementstmt 100% 40 / 40 Branchbran 83.3% 15 / 18 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 9 / 9 Podpod n/a totaltotal 95.8% 69 / 72 CC 11 SCAR 14.8
CC
11
Cov
95%
__ANON__
8.0
_as_indexer
3.0
__ANON__
2.1
CRAP 4.4
« Data/Frame/Util.pm ↑ Summary Data/Frame/Role/Rlike.pm »
1 package Data::Frame::Indexer;
2 12 $Data::Frame::Indexer::VERSION = '0.006005';
3 # ABSTRACT: Function interface for indexer
4  
5 12 ▶use Data::Frame::Setup;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 12 ▶use Data::Frame::Indexer::Integer;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 12 ▶use Data::Frame::Indexer::Label;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 12 ▶use Data::Frame::Types qw(:all);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 12 ▶use Data::Frame::Util qw(is_discrete);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 12 ▶use parent qw(Exporter::Tiny);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 12 our @EXPORT_OK = qw(indexer_s indexer_i);
15 12 our %EXPORT_TAGS = ( all => \@EXPORT_OK );
16  
17  
18 my $NumericIndices =
19 318 ▶ ColumnLike->where( sub { $_->type ne 'byte' and not is_discrete($_) } );
Subroutine __ANON__: called CC=2 SCAR=7.2
Branch: 1 branch
BranchTrueFalseTotal
$_->type ne "byte" and not is_discrete($_) 318 0 318
20  
21 24 ▶fun _as_indexer ($fallback_indexer_class) {
Subroutine _as_indexer: called CC=3 SCAR=11.0
Branch: 2 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for fun _as_indexer (expected 1, got ' . @_ . ')') 0 24 24
@_ > 1 and Function::Parameters::_croak('Too many arguments for fun _as_indexer (expected 1, got ' . @_ . ')') 0 24 24
22 418 ▶ return sub {
Subroutine __ANON__: called CC=8 SCAR=20.8
23 418 ▶ my $x = @_ > 1 ? \@_ : @_ == 1 ? $_[0] : [];
Branch: 2 branches
BranchTrueFalseTotal
@_ > 1 ? : 40 378 418
@_ == 1 ? : 369 9 378
24  
25 418 ▶ return undef unless defined $x;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $x 7 411 418
26 411 ▶ return $x if ( Indexer->check($x) );
Branch: 1 branch
BranchTrueFalseTotal
if &Indexer()->check($x) 17 394 411
27  
28 394 ▶ unless ( Ref::Util::is_plain_arrayref($x) or $x->$_DOES('PDL') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (Ref::Util::XS::is_plain_arrayref($x) or $x->$Data::Frame::Indexer::_DOES("PDL")) 16 378 394
Condition100%3/3
Ref::Util::XS::is_plain_arrayref($x) or $x->$Data::Frame::Indexer::_DOES("PDL")
l!l&&r!l&&!r
6031816
MC/DC100%2/2
Ref::Util::XS::is_plain_arrayref($x) or $x->$Data::Frame::Indexer::_DOES("PDL")
Ref::Util::XS::is_plain_arrayref($x) $x->$Data::Frame::Indexer::_DOES("PDL")
Truth table100%3/3
A or B
A= Ref::Util::XS::is_plain_arrayref($x)B= $x->$Data::Frame::Indexer::_DOES("PDL")
ABresult
1X1
011
000
29 16 $x = [$x];
30 }
31 394 ▶ if ( $NumericIndices->check($x) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($NumericIndices->check($x)) 28 366 394
32 28 return Data::Frame::Indexer::Integer->new( indexer => $x->unpdl );
33 }
34 366 $fallback_indexer_class->new( indexer => $x );
35 24 };
36 12 }
37  
38 12 *indexer_s = _as_indexer('Data::Frame::Indexer::Label');
39 12 *indexer_i = _as_indexer('Data::Frame::Indexer::Integer');
40  
41 12 1;
42  
43 __END__
« Data/Frame/Util.pm ↑ Summary Data/Frame/Role/Rlike.pm »