lib/App/SeismicUnixGui/specs/statsMath/sualford_spec.pm untested

filter: Statementstmt 0.0% 0 / 166 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 18 Podpod 0.0% 0 / 13 totaltotal 0.0% 0 / 211 CC 8 SCAR 14.4
CC
8
Cov
0%
get_binding_index_aref
6.0
get_binding_length
6.0
get_file_dialog_type_aref
6.0
CRAP 4.2
1 package App::SeismicUnixGui::specs::statsMath::sualford_spec;
2 use Moose;
3 our $VERSION = '0.0.1';
4  
5 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
6 use App::SeismicUnixGui::misc::SeismicUnix qw($bin $su $suffix_bin $suffix_su $suffix_txt $txt);
7 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
8 use aliased 'App::SeismicUnixGui::sunix::statsMath::sualford';
9 my $get = L_SU_global_constants->new();
10 my $Project = Project_config->new();
11 my $sualford = sualford->new();
12  
13 my $var = $get->var();
14  
15 my $empty_string = $var->{_empty_string};
16 my $true = $var->{_true};
17 my $false = $var->{_false};
18 my $file_dialog_type = $get->file_dialog_type_href();
19 my $flow_type = $get->flow_type_href();
20  
21 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
22 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); # output data directory
23 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); # output data directory
24 my $PL_SEISMIC = $Project->PL_SEISMIC();
25 my $max_index = 16;
26  
27 my $sualford_spec = {
28 _CONFIG => $PL_SEISMIC,
29 _DATA_DIR_IN => $DATA_SEISMIC_SU,
30 _DATA_DIR_OUT => $DATA_SEISMIC_SU,
31 _binding_index_aref => '',
32 _suffix_type_in => $su,
33 _data_suffix_in => $suffix_su,
34 _suffix_type_out => $su,
35 _data_suffix_out => $suffix_su,
36 _file_dialog_type_aref => '',
37 _flow_type_aref => '',
38 _has_infile => $true,
39 _has_outpar => $false,
40 _has_pipe_in => $true,
41 _has_pipe_out => $true,
42 _has_redirect_in => $true,
43 _has_redirect_out => $true,
44 _has_subin_in => $false,
45 _has_subin_out => $false,
46 _is_data => $false,
47 _is_first_of_2 => $true,
48 _is_first_of_3or_more => $true,
49 _is_first_of_4or_more => $true,
50 _is_last_of_2 => $false,
51 _is_last_of_3or_more => $false,
52 _is_last_of_4or_more => $false,
53 _is_suprog => $true,
54 _is_superflow => $false,
55 _max_index => $max_index,
56 _prefix_aref => '',
57 _suffix_aref => '',
58 };
59  
60 =head2 sub binding_index_aref
61  
62 =cut
63  
64 sub binding_index_aref {
65  
66 my $self = @_;
67  
68 my @index;
69  
70 # first binding index (index=0)
71 # connects to fourth item (index=3)
72 # in the parameter list
73 $index[0] = 3; # inbound item
74 $index[1] = 4; # inbound item
75 $index[2] = 5; # inbound item
76 $index[3] = 6; # inbound item
77 $index[4] = 10; # outbound item
78 $index[5] = 11; # outbound item
79 $index[6] = 12; # outbound item
80 $index[7] = 13; # outbound item
81  
82 $sualford_spec->{_binding_index_aref} = \@index;
83 return ();
84  
85 }
86  
87 =head2 sub file_dialog_type_aref
88  
89 type of dialog (Data, Flow, SaveAs) is needed by binding
90 one type of dialog for each index
91 =cut
92  
93 sub file_dialog_type_aref {
94  
95 my $self = @_;
96  
97 my @type;
98  
99 my $index_aref = get_binding_index_aref();
100 my @index = @$index_aref;
101  
102 # bound index will look for data
103 $type[0] = '';
104 $type[ $index[0] ] = $file_dialog_type->{_Data};
105 $type[ $index[1] ] = $file_dialog_type->{_Data};
106 $type[ $index[3] ] = $file_dialog_type->{_Data};
107 $type[ $index[4] ] = $file_dialog_type->{_Data};
108 $type[ $index[5] ] = $file_dialog_type->{_Data};
109 $type[ $index[6] ] = $file_dialog_type->{_Data};
110 $type[ $index[7] ] = $file_dialog_type->{_Data};
111  
112 $sualford_spec->{_file_dialog_type_aref} = \@type;
113 return ();
114  
115 }
116  
117 =head2 sub flow_type_aref
118  
119 =cut
120  
121 sub flow_type_aref {
122  
123 my $self = @_;
124  
125 my @type;
126  
127 $type[0] = $flow_type->{_user_built};
128  
129 $sualford_spec->{_flow_type_aref} = \@type;
130 return ();
131  
132 }
133  
134 =head2 sub get_binding_index_aref
135  
136 =cut
137  
138 sub get_binding_index_aref {
139  
140 my $self = @_;
141 my @index;
142  
143 if ( $sualford_spec->{_binding_index_aref} ) {
144  
145 my $index_aref = $sualford_spec->{_binding_index_aref};
146 return ($index_aref);
147  
148 } else {
149 print("sualford_spec, get_binding_index_aref, missing binding_index_aref\n");
150 return ();
151 }
152  
153 my $index_aref = $sualford_spec->{_binding_index_aref};
154 }
155  
156 =head2 sub get_binding_length
157  
158 =cut
159  
160 sub get_binding_length {
161  
162 my $self = @_;
163  
164 if ( $sualford_spec->{_binding_index_aref} ) {
165  
166 my $binding_length = scalar @{ $sualford_spec->{_binding_index_aref} };
167 return ($binding_length);
168  
169 } else {
170 print("sualford_spec, get_binding_length, missing binding_length\n");
171 return ();
172 }
173  
174 return ();
175 }
176  
177 =head2 sub get_file_dialog_type_aref
178  
179 =cut
180  
181 sub get_file_dialog_type_aref {
182  
183 my $self = @_;
184 if ( $sualford_spec->{_file_dialog_type_aref} ) {
185  
186 my $index_aref = $sualford_spec->{_file_dialog_type_aref};
187 return ($index_aref);
188  
189 } else {
190 print("sualford_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n");
191 return ();
192 }
193  
194 return ();
195 }
196  
197 =head2 sub get_flow_type_aref
198  
199 =cut
200  
201 sub get_flow_type_aref {
202  
203 my $self = @_;
204  
205 if ( $sualford_spec->{_flow_type_aref} ) {
206  
207 my $index_aref = $sualford_spec->{_flow_type_aref};
208 return ($index_aref);
209  
210 } else {
211 print("sualford_spec, get_flow_type_aref, missing flow_type_aref\n");
212 return ();
213 }
214  
215 }
216  
217 =head2 sub get_incompatibles
218  
219 =cut
220  
221 sub get_incompatibles {
222  
223 my $self = @_;
224 my @needed;
225  
226 my @_need_both;
227  
228 my @_need_only_1;
229  
230 my @_none_needed;
231  
232 my @_all_needed;
233  
234 my $params = {
235  
236 _need_both => \@_need_both,
237 _need_only_1 => \@_need_only_1,
238 _none_needed => \@_none_needed,
239 _all_needed => \@_all_needed,
240  
241 };
242  
243 my @of_two = ( 'xx', 'yy' );
244 push @{ $params->{_need_only_1} }, \@of_two;
245  
246 my $len_1_needed = scalar @{ $params->{_need_only_1} };
247  
248 if ( $len_1_needed >= 1 ) {
249  
250 for ( my $i = 0; $i < $len_1_needed; $i++ ) {
251  
252 print("sualford, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n");
253  
254 }
255  
256 } else {
257 print("get_incompatibles, no incompatibles\n");
258 }
259  
260 return ($params);
261  
262 }
263  
264 =head2 sub get_prefix_aref
265  
266 =cut
267  
268 sub get_prefix_aref {
269  
270 my $self = @_;
271  
272 if ( $sualford_spec->{_prefix_aref} ) {
273  
274 my $prefix_aref = $sualford_spec->{_prefix_aref};
275 return ($prefix_aref);
276  
277 } else {
278 print("sualford_spec, get_prefix_aref, missing prefix_aref\n");
279 return ();
280 }
281  
282 return ();
283 }
284  
285 =head2 sub get_suffix_aref
286  
287 =cut
288  
289 sub get_suffix_aref {
290  
291 my $self = @_;
292  
293 if ( $sualford_spec->{_suffix_aref} ) {
294  
295 my $suffix_aref = $sualford_spec->{_suffix_aref};
296 return ($suffix_aref);
297  
298 } else {
299 print("$sualford_spec, get_suffix_aref, missing suffix_aref\n");
300 return ();
301 }
302  
303 return ();
304 }
305  
306 =head2 sub prefix_aref
307  
308 Include in the Set up
309 sections of an output Poop flow.
310  
311 prefixes and suffixes to parameter labels
312 are filtered by sunix_pl
313  
314 =cut
315  
316 sub prefix_aref {
317  
318 my $self = @_;
319  
320 my @prefix;
321  
322 for ( my $i = 0; $i < $max_index; $i++ ) {
323  
324 $prefix[$i] = $empty_string;
325  
326 }
327  
328 my $index_aref = get_binding_index_aref();
329 my @index = @$index_aref;
330  
331 # label 4 in GUI is input xx_file and needs a home directory
332 $prefix[ $index[0] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
333  
334 # label 5 in GUI is input yy_file and needs a home directory
335 $prefix[ $index[1] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
336  
337 # label 6 in GUI is input zz_file and needs a home directory
338 $prefix[ $index[2] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
339  
340 # label 7 in GUI is input xx_file and needs a home directory
341 $prefix[ $index[3] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
342  
343 # label 11 in GUI is output yy_file and needs a home directory
344 $prefix[ $index[4] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
345  
346 # label 12 in GUI is output zz_file and needs a home directory
347 $prefix[ $index[5] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
348  
349 # label 13 in GUI is output yy_file and needs a home directory
350 $prefix[ $index[6] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
351  
352 # label 14 in GUI is output zz_file and needs a home directory
353 $prefix[ $index[7] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
354  
355 $sualford_spec->{_prefix_aref} = \@prefix;
356 return ();
357  
358 }
359  
360 =head2 sub suffix_aref
361  
362 Initialize suffixes as empty
363 values
364  
365 =cut
366  
367 sub suffix_aref {
368  
369 my $self = @_;
370  
371 my @suffix;
372  
373 for ( my $i = 0; $i < $max_index; $i++ ) {
374  
375 $suffix[$i] = $empty_string;
376  
377 }
378  
379 my $index_aref = get_binding_index_aref();
380 my @index = @$index_aref;
381  
382 # label 4 in GUI is input xx_file and needs a home directory
383 $suffix[ $index[0] ] = '' . '' . '$suffix_bin';
384  
385 # label 5 in GUI is input yy_file and needs a home directory
386 $suffix[ $index[1] ] = '' . '' . '$suffix_bin';
387  
388 # label 6 in GUI is input xx_file and needs a home directory
389 $suffix[ $index[2] ] = '' . '' . '$suffix_bin';
390  
391 # label 7 in GUI is input yy_file and needs a home directory
392 $suffix[ $index[3] ] = '' . '' . '$suffix_bin';
393  
394 # label 11 in GUI is output xx_file and needs a home directory
395 $suffix[ $index[4] ] = '' . '' . '$suffix_bin';
396  
397 # label 12 in GUI is output yy_file and needs a home directory
398 $suffix[ $index[5] ] = '' . '' . '$suffix_bin';
399  
400 # label 13 in GUI is output xx_file and needs a home directory
401 $suffix[ $index[6] ] = '' . '' . '$suffix_bin';
402  
403 # label 14 in GUI is output yy_file and needs a home directory
404 $suffix[ $index[7] ] = '' . '' . '$suffix_bin';
405  
406 $sualford_spec->{_suffix_aref} = \@suffix;
407 return ();
408  
409 }
410  
411 =head2 sub variables
412  
413  
414 return a hash array
415 with definitions
416
417 =cut
418  
419 sub variables {
420  
421 my ($self) = @_;
422 my $hash_ref = $sualford_spec;
423 return ($hash_ref);
424 }
425  
426 1;