NumSeq/Base/IterateIth.pm

filter: Statementstmt 94.7% 18 / 19 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 3 totaltotal 83.3% 25 / 30 CC 2 SCAR 2.7
CC
2
Cov
90%
next
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« NumSeq/Base/IteratePred.pm ↑ Summary NumSeq/OEIS/Catalogue/Plugin/BuiltinTable.pm »
1 # Copyright 2011, 2012, 2013, 2014, 2016, 2019, 2020 Kevin Ryde
2  
3 # This file is part of Math-NumSeq.
4 #
5 # Math-NumSeq is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by the
7 # Free Software Foundation; either version 3, or (at your option) any later
8 # version.
9 #
10 # Math-NumSeq is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # for more details.
14 #
15 # You should have received a copy of the GNU General Public License along
16 # with Math-NumSeq. If not, see <http://www.gnu.org/licenses/>.
17  
18 package Math::NumSeq::Base::IterateIth;
19 20 ▶use 5.004;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 20 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
21  
22 20 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
23 20 $VERSION = 75;
24  
25 339 ▶sub rewind {
Subroutine rewind: called CC=1 SCAR=0.0
Pod undocumented
26 339 my ($self) = @_;
27 339 $self->seek_to_i($self->i_start);
28 }
29 2018 ▶sub seek_to_i {
Subroutine seek_to_i: called CC=1 SCAR=0.0
Pod undocumented
30 2018 my ($self, $i) = @_;
31 2018 $self->{'i'} = $i;
32 }
33 45760 ▶sub next {
Subroutine next: called CC=2 SCAR=7.4
Pod undocumented
34 45760 my ($self) = @_;
35 45760 my $i = $self->{'i'}++;
36 45760 ▶ if (defined (my $value = $self->ith($i))) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $value = $self->ith($i))) { } 45760 0 45760
37 45760 return ($i, $value);
38 } else {
39 0 return;
40 }
41 }
42  
43 20 1;
44 __END__
« NumSeq/Base/IteratePred.pm ↑ Summary NumSeq/OEIS/Catalogue/Plugin/BuiltinTable.pm »