| 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
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||
| 36 | 4 | ▶ | if (! (ref $fileObj && (ref($fileObj) eq 'Text::NASA_Ames'))) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
ref $fileObj and ref $fileObj eq "Text::NASA_Ames"
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"
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 4 | my ($x, @a) = split ' ', $line; | |||||||||||||||||||||||||||
| 68 | 4 | ▶ | if (@a != $self->nAuxV) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 74 | if $self->nAuxV > 0; | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | 4 | my @vHelp; | |||||||||||||||||||||||||||
| 77 | 4 | ▶ | for (my $i = 0; $i < $self->nV; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 78 | 16 | $line = $self->nextLine; | |||||||||||||||||||||||||||
| 79 | 16 | ▶ | unless ($line) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 86 | 16 | my @vi = split ' ', $line; | |||||||||||||||||||||||||||
| 87 | 16 | ▶ | if (@vi != $self->nVPM()->[0]) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 95 | 160 | $vHelp[$j][$i] = $vi[$j]; | |||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||
| 99 | 4 | ▶ | for (my $j = 0; $j < $self->nVPM()->[0]; $j++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||