NASA_Ames/FFI1020.pm

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