lib/App/SeismicUnixGui/specs/header/sustaticrrs_spec.pm untested

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