NASA_Ames/FFI2110.pm

filter: Statementstmt 88.4% 61 / 69 Branchbran 61.1% 11 / 18 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 78.3% 83 / 106 CC 12 SCAR 19.4
CC
12
Cov
80%
_refillBuffer
12.0
new
4.4
BEGIN
1.0
CRAP 6.9
« NASA_Ames/FFIx010.pm ↑ Summary NASA_Ames/FFI2310.pm »
1 package Pure::Text::NASA_Ames::FFI2110;
2 1 ▶use base (Text::NASA_Ames);
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 __PACKAGE__->mk_accessors(qw(xScal1 xMiss1));
4  
5 package Text::NASA_Ames::FFI2110;
6 1 ▶use base qw(Pure::Text::NASA_Ames::FFI2110);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use 5.00600;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 1 our $VERSION = do { my @r = (q$Revision: 1.1 $ =~ /\d+/g); sprintf " %d." . "%02d" x $#r, @r };
13  
14  
15 =head1 NAME
16  
17 Text::NASA_Ames::FFI2110 - Implementation of FFI2110 NASA_Ames format
18  
19 =head1 SYNOPSIS
20  
21  
22 =head1 DESCRIPTION
23  
24 This class should normally not be called directly but through the
25 L<Text::NASA_Ames> class indirectly.
26  
27 =head1 PUBLIC METHODS
28  
29 =over 4
30  
31 =item new (Text::NASA_Ames-object || options for new NASA_Ames)
32  
33 parses the (rest of the) header (body and comments)
34  
35 =cut
36  
37 2 ▶sub new {
Subroutine new: called CC=4 SCAR=14.9
Pod documented
38 2 my ($class, $fileObj) = @_;
39 2 ▶ $class = ref $class || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
40 2 ▶ if (! (ref $fileObj && (ref($fileObj) eq 'Text::NASA_Ames'))) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $fileObj and ref $fileObj eq "Text::NASA_Ames") 0 2 2
Condition33%1/3
ref $fileObj and ref $fileObj eq "Text::NASA_Ames"
!ll&&!rl&&r
002
MC/DC0%0/2
ref $fileObj and ref $fileObj eq "Text::NASA_Ames"
ref $fileObj ref $fileObj eq "Text::NASA_Ames"
Truth table33%1/3
A and B
A= ref $fileObjB= ref $fileObj eq "Text::NASA_Ames"
ABresult
0X0
100
111
41 0 return new Text::NASA_Ames($fileObj);
42 }
43 2 my $self = $fileObj;
44 2 bless $self, $class;
45  
46 2 $self->_parseList('dX', $self->nIV);
47 2 $self->_parseLines('xName', $self->nIV);
48 2 $self->_parseVDeclaration;
49 2 $self->_parseAuxDeclaration;
50 2 $self->_parseTailHeader;
51  
52 2 return $self;
53 }
54  
55 2 ▶sub _parseAuxDeclaration {
Subroutine _parseAuxDeclaration: called CC=1 SCAR=0.0
56 2 my $self = shift;
57 2 $self->SUPER::_parseAuxDeclaration;
58  
59 # move first aux value to NX1
60 2 $self->nAuxV($self->nAuxV - 1);
61 2 my @aScal = @{ $self->aScal };
62 2 $self->xScal1(shift @aScal);
63 2 $self->aScal(\@aScal);
64 2 my @aMiss = @{ $self->aMiss };
65 2 $self->xMiss1(shift @aMiss);
66 2 $self->aMiss(\@aMiss);
67 2 my @aName = @{ $self->aName };
68 2 shift @aName;
69 2 $self->aName(\@aName);
70 }
71  
72 9 ▶sub _refillBuffer {
Subroutine _refillBuffer: called CC=9 SCAR=24.8
73 9 my $self = shift;
74  
75 9 my $line = $self->nextLine;
76 9 ▶ return unless defined $line;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $line 1 8 9
77  
78 8 my ($x2, $nX1, @a) = split ' ', $line;
79 8 ▶ if (@a != $self->nAuxV) {
Branch: 1 branch
BranchTrueFalseTotal
if (@a != $self->nAuxV) 0 8 8
80 0 $self->_carp("not enough elements for Aux, expected ".
81 $self->nAuxV() . ", got ". scalar @a);
82 0 return;
83 }
84 8 ▶ $self->_cleanAndScaleVals($self->aMiss, $self->aScal, \@a)
Branch: 1 branch
BranchTrueFalseTotal
if $self->nAuxV > 0 8 0 8
85 if $self->nAuxV > 0;
86  
87 8 ▶ for (my $i = 0; $i < $nX1; $i++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $nX1) 44 8 52
88 44 $line = $self->nextLine;
89 44 ▶ unless ($line) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($line) 0 44 44
90 0 $self->_carp("not enough elements for V".
91 " in row ". $self->currentLine);
92 0 return;
93 }
94
95 44 my ($x1, @v) = split ' ', $line;
96 44 ▶ if (@v != $self->nV) {
Branch: 1 branch
BranchTrueFalseTotal
if (@v != $self->nV) 0 44 44
97 0 $self->_carp("not enough elements for v, expected ".
98 $self->nV . ", got ". scalar @v .
99 " in row ". $self->currentLine);
100 0 return;
101 }
102 44 ▶ if ($x1 == $self->xMiss1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($x1 == $self->xMiss1) { } 0 44 44
103 0 $x1 = undef;
104 } else {
105 44 $x1 *= $self->xScal1;
106 }
107 44 ▶ $self->_cleanAndScaleVals($self->vMiss, $self->vScal, \@v)
Branch: 1 branch
BranchTrueFalseTotal
if $self->nV > 0 44 0 44
108 if $self->nV > 0;
109 44 push @{ $self->dataBuffer },
110 new Text::NASA_Ames::DataEntry({X => [ $x1, $x2 ],
111 V => \@v,
112 A => \@a});
113 }
114 }
115  
116 1 1;
117 __END__
« NASA_Ames/FFIx010.pm ↑ Summary NASA_Ames/FFI2310.pm »