| 1 | package Pure::Text::NASA_Ames::FFI2310; | ||||||||||||||||||||||||||||
| 2 | 1 | ▶ | use base (Text::NASA_Ames); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 1 | __PACKAGE__->mk_accessors(qw(xScal1 xMiss1 nXScal1 nXMiss1 dXScal1 dXMiss1)); | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | package Text::NASA_Ames::FFI2310; | ||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use base qw(Pure::Text::NASA_Ames::FFI2310); | ||||||||||||||||||||||||||
|
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::FFI2310 - Implementation of FFI2310 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
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||||||||||
| 40 | 2 | ▶ | 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"
| |||||||||||||||||||||||||||||
| 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 - 1); | |||||||||||||||||||||||||||
| 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 three aux value to NX1 .. NX3 | ||||||||||||||||||||||||||||
| 60 | 2 | $self->nAuxV($self->nAuxV - 3); | |||||||||||||||||||||||||||
| 61 | 2 | my @aScal = @{ $self->aScal }; | |||||||||||||||||||||||||||
| 62 | 2 | $self->nXScal1(shift @aScal); | |||||||||||||||||||||||||||
| 63 | 2 | $self->xScal1(shift @aScal); | |||||||||||||||||||||||||||
| 64 | 2 | $self->dXScal1(shift @aScal); | |||||||||||||||||||||||||||
| 65 | 2 | $self->aScal(\@aScal); | |||||||||||||||||||||||||||
| 66 | 2 | my @aMiss = @{ $self->aMiss }; | |||||||||||||||||||||||||||
| 67 | 2 | $self->nXMiss1(shift @aMiss); | |||||||||||||||||||||||||||
| 68 | 2 | $self->xMiss1(shift @aMiss); | |||||||||||||||||||||||||||
| 69 | 2 | $self->dXMiss1(shift @aMiss); | |||||||||||||||||||||||||||
| 70 | 2 | $self->aMiss(\@aMiss); | |||||||||||||||||||||||||||
| 71 | 2 | my @aName = @{ $self->aName }; | |||||||||||||||||||||||||||
| 72 | 2 | shift @aName; | |||||||||||||||||||||||||||
| 73 | 2 | shift @aName; | |||||||||||||||||||||||||||
| 74 | 2 | shift @aName; | |||||||||||||||||||||||||||
| 75 | 2 | $self->aName(\@aName); | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | 8 | ▶ | sub _refillBuffer { | ||||||||||||||||||||||||||
|
Subroutine
_refillBuffer: called CC=10 SCAR=24.3
| |||||||||||||||||||||||||||||
| 79 | 8 | my $self = shift; | |||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | 8 | my $line = $self->nextLine; | |||||||||||||||||||||||||||
| 82 | 8 | ▶ | return unless defined $line; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | 7 | my ($x2, $nX1, $x1_0, $dX1, @a) = split ' ', $line; | |||||||||||||||||||||||||||
| 85 | 7 | my @help = ($nX1, $x1_0, $dX1); | |||||||||||||||||||||||||||
| 86 | 7 | $self->_cleanAndScaleVals([$self->nXMiss1, $self->xMiss1, $self->dXMiss1], | |||||||||||||||||||||||||||
| 87 | [$self->nXScal1, $self->xScal1, $self->dXScal1], | ||||||||||||||||||||||||||||
| 88 | \@help); | ||||||||||||||||||||||||||||
| 89 | 7 | ($nX1, $x1_0, $dX1) = @help; | |||||||||||||||||||||||||||
| 90 | 7 | ▶ | if (@a != $self->nAuxV) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 91 | 0 | $self->_carp("not enough elements for Aux, expected ". | |||||||||||||||||||||||||||
| 92 | $self->nAuxV() . ", got ". scalar @a); | ||||||||||||||||||||||||||||
| 93 | 0 | return; | |||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||
| 95 | 7 | ▶ | $self->_cleanAndScaleVals($self->aMiss, $self->aScal, \@a) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 96 | if $self->nAuxV > 0; | ||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||
| 98 | 7 | my @vHelp; | |||||||||||||||||||||||||||
| 99 | 7 | ▶ | for (my $i = 0; $i < $self->nV; $i++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 100 | 7 | $line = $self->nextLine; | |||||||||||||||||||||||||||
| 101 | 7 | ▶ | unless ($line) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 0 | $self->_carp("not enough elements for V". | |||||||||||||||||||||||||||
| 103 | " in row ". $self->currentLine); | ||||||||||||||||||||||||||||
| 104 | 0 | return; | |||||||||||||||||||||||||||
| 105 | } | ||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||
| 107 | 7 | my (@vi) = split ' ', $line; | |||||||||||||||||||||||||||
| 108 | 7 | ▶ | if (@vi != $nX1) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 109 | 0 | $self->_carp("not enough elements for nX1, expected ". | |||||||||||||||||||||||||||
| 110 | $nX1 . ", got ". scalar @vi . | ||||||||||||||||||||||||||||
| 111 | " in row ". $self->currentLine); | ||||||||||||||||||||||||||||
| 112 | 0 | return; | |||||||||||||||||||||||||||
| 113 | } | ||||||||||||||||||||||||||||
| 114 | # transposing | ||||||||||||||||||||||||||||
| 115 | 7 | ▶ | for (my $j = 0; $j < $nX1; $j++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 116 | 40 | $vHelp[$j][$i] = $vi[$j]; | |||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||
| 120 | 7 | ▶ | for (my $j = 0; $j < $nX1; $j++) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 121 | 40 | my $x1 = $x1_0 + $j * $dX1; | |||||||||||||||||||||||||||
| 122 | 40 | ▶ | $self->_cleanAndScaleVals($self->vMiss, $self->vScal, $vHelp[$j]) | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 123 | if $self->nV > 0; | ||||||||||||||||||||||||||||
| 124 | 40 | push @{ $self->dataBuffer }, | |||||||||||||||||||||||||||
| 125 | new Text::NASA_Ames::DataEntry({X => [ $x1, $x2 ], | ||||||||||||||||||||||||||||
| 126 | V => $vHelp[$j], | ||||||||||||||||||||||||||||
| 127 | A => \@a}); | ||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 1 | 1; | |||||||||||||||||||||||||||
| 132 | __END__ | ||||||||||||||||||||||||||||