lib/App/SeismicUnixGui/specs/model/elatriuni_spec.pm untested

filter: Statementstmt 0.0% 0 / 175 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 / 220 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::model::elatriuni_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::model::elatriuni';
9 my $get = L_SU_global_constants->new();
10 my $Project = Project_config->new();
11 my $elatriuni = elatriuni->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 = 15;
26  
27 my $elatriuni_spec = {
28 _CONFIG => $PL_SEISMIC,
29 _DATA_DIR_IN => $DATA_SEISMIC_BIN,
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 second item (index=1)
72 # in the parameter list
73 $index[0] = 0; # outbound item is bound
74 $index[1] = 1; # outbound item is bound
75 $index[2] = 2; # outbound item is bound
76 $index[3] = 3; # outbound item is bound
77 $index[4] = 4; # outbound item is bound
78 $index[5] = 5; # outbound item is bound
79 $index[6] = 6; # outbound item is bound
80 $index[7] = 7; # outbound item is bound
81 $index[8] = 8; # outbound item is bound
82 $index[9] = 15; # outbound item is bound
83  
84 $elatriuni_spec->{_binding_index_aref} = \@index;
85 return ();
86  
87 }
88  
89 =head2 sub file_dialog_type_aref
90  
91 type of dialog (Data, Flow, SaveAs) is needed by binding
92 one type of dialog for each index
93 =cut
94  
95 sub file_dialog_type_aref {
96  
97 my $self = @_;
98  
99 my @type;
100  
101 my $index_aref = get_binding_index_aref();
102 my @index = @$index_aref;
103  
104 # bound index will look for data
105 $type[0] = '';
106 $type[ $index[0] ] = $file_dialog_type->{_Data};
107 $type[ $index[1] ] = $file_dialog_type->{_Data};
108 $type[ $index[2] ] = $file_dialog_type->{_Data};
109 $type[ $index[3] ] = $file_dialog_type->{_Data};
110 $type[ $index[4] ] = $file_dialog_type->{_Data};
111 $type[ $index[5] ] = $file_dialog_type->{_Data};
112 $type[ $index[6] ] = $file_dialog_type->{_Data};
113 $type[ $index[7] ] = $file_dialog_type->{_Data};
114 $type[ $index[8] ] = $file_dialog_type->{_Data};
115 $type[ $index[9] ] = $file_dialog_type->{_Data};
116 $elatriuni_spec->{_file_dialog_type_aref} = \@type;
117 return ();
118  
119 }
120  
121 =head2 sub flow_type_aref
122  
123 =cut
124  
125 sub flow_type_aref {
126  
127 my $self = @_;
128  
129 my @type;
130  
131 $type[0] = $flow_type->{_user_built};
132  
133 $elatriuni_spec->{_flow_type_aref} = \@type;
134 return ();
135  
136 }
137  
138 =head2 sub get_binding_index_aref
139  
140 =cut
141  
142 sub get_binding_index_aref {
143  
144 my $self = @_;
145 my @index;
146  
147 if ( $elatriuni_spec->{_binding_index_aref} ) {
148  
149 my $index_aref = $elatriuni_spec->{_binding_index_aref};
150 return ($index_aref);
151  
152 } else {
153 print("elatriuni_spec, get_binding_index_aref, missing binding_index_aref\n");
154 return ();
155 }
156  
157 my $index_aref = $elatriuni_spec->{_binding_index_aref};
158 }
159  
160 =head2 sub get_binding_length
161  
162 =cut
163  
164 sub get_binding_length {
165  
166 my $self = @_;
167  
168 if ( $elatriuni_spec->{_binding_index_aref} ) {
169  
170 my $binding_length = scalar @{ $elatriuni_spec->{_binding_index_aref} };
171 return ($binding_length);
172  
173 } else {
174 print("elatriuni_spec, get_binding_length, missing binding_length\n");
175 return ();
176 }
177  
178 return ();
179 }
180  
181 =head2 sub get_file_dialog_type_aref
182  
183 =cut
184  
185 sub get_file_dialog_type_aref {
186  
187 my $self = @_;
188 if ( $elatriuni_spec->{_file_dialog_type_aref} ) {
189  
190 my $index_aref = $elatriuni_spec->{_file_dialog_type_aref};
191 return ($index_aref);
192  
193 } else {
194 print("elatriuni_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n");
195 return ();
196 }
197  
198 return ();
199 }
200  
201 =head2 sub get_flow_type_aref
202  
203 =cut
204  
205 sub get_flow_type_aref {
206  
207 my $self = @_;
208  
209 if ( $elatriuni_spec->{_flow_type_aref} ) {
210  
211 my $index_aref = $elatriuni_spec->{_flow_type_aref};
212 return ($index_aref);
213  
214 } else {
215 print("elatriuni_spec, get_flow_type_aref, missing flow_type_aref\n");
216 return ();
217 }
218  
219 }
220  
221 =head2 sub get_incompatibles
222  
223 =cut
224  
225 sub get_incompatibles {
226  
227 my $self = @_;
228 my @needed;
229  
230 my @_need_both;
231  
232 my @_need_only_1;
233  
234 my @_none_needed;
235  
236 my @_all_needed;
237  
238 my $params = {
239  
240 _need_both => \@_need_both,
241 _need_only_1 => \@_need_only_1,
242 _none_needed => \@_none_needed,
243 _all_needed => \@_all_needed,
244  
245 };
246  
247 my @of_two = ( 'xx', 'yy' );
248 push @{ $params->{_need_only_1} }, \@of_two;
249  
250 my $len_1_needed = scalar @{ $params->{_need_only_1} };
251  
252 if ( $len_1_needed >= 1 ) {
253  
254 for ( my $i = 0; $i < $len_1_needed; $i++ ) {
255  
256 print("elatriuni, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n");
257  
258 }
259  
260 } else {
261 print("get_incompatibles, no incompatibles\n");
262 }
263  
264 return ($params);
265  
266 }
267  
268 =head2 sub get_prefix_aref
269  
270 =cut
271  
272 sub get_prefix_aref {
273  
274 my $self = @_;
275  
276 if ( $elatriuni_spec->{_prefix_aref} ) {
277  
278 my $prefix_aref = $elatriuni_spec->{_prefix_aref};
279 return ($prefix_aref);
280  
281 } else {
282 print("elatriuni_spec, get_prefix_aref, missing prefix_aref\n");
283 return ();
284 }
285  
286 return ();
287 }
288  
289 =head2 sub get_suffix_aref
290  
291 =cut
292  
293 sub get_suffix_aref {
294  
295 my $self = @_;
296  
297 if ( $elatriuni_spec->{_suffix_aref} ) {
298  
299 my $suffix_aref = $elatriuni_spec->{_suffix_aref};
300 return ($suffix_aref);
301  
302 } else {
303 print("$elatriuni_spec, get_suffix_aref, missing suffix_aref\n");
304 return ();
305 }
306  
307 return ();
308 }
309  
310 =head2 sub prefix_aref
311  
312 Include in the Set up
313 sections of an output Poop flow.
314  
315 prefixes and suffixes to parameter labels
316 are filtered by sunix_pl
317  
318 =cut
319  
320 sub prefix_aref {
321  
322 my $self = @_;
323  
324 my @prefix;
325  
326 for ( my $i = 0; $i < $max_index; $i++ ) {
327  
328 $prefix[$i] = $empty_string;
329  
330 }
331  
332 my $index_aref = get_binding_index_aref();
333 my @index = @$index_aref;
334  
335 # label 1 in GUI is input xx_file and needs a home directory
336 $prefix[ $index[0] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
337  
338 # label 2 in GUI is output xx_file and needs a home directory
339 $prefix[ $index[1] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
340  
341 # label 3 in GUI is output xx_file and needs a home directory
342 $prefix[ $index[2] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
343  
344 # label 4 in GUI is output xx_file and needs a home directory
345 $prefix[ $index[3] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
346  
347 # label 5 in GUI is output xx_file and needs a home directory
348 $prefix[ $index[4] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
349  
350 # label 6 in GUI is output xx_file and needs a home directory
351 $prefix[ $index[5] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
352  
353 # label 7 in GUI is output xx_file and needs a home directory
354 $prefix[ $index[6] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
355  
356 # label 8 in GUI is output xx_file and needs a home directory
357 $prefix[ $index[7] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
358  
359 # label 9 in GUI is output xx_file and needs a home directory
360 $prefix[ $index[8] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
361  
362 # label 16 in GUI is output xx_file and needs a home directory
363 $prefix[ $index[9] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
364  
365 $elatriuni_spec->{_prefix_aref} = \@prefix;
366 return ();
367  
368 }
369  
370 =head2 sub suffix_aref
371  
372 Initialize suffixes as empty
373 values
374  
375 =cut
376  
377 sub suffix_aref {
378  
379 my $self = @_;
380  
381 my @suffix;
382  
383 for ( my $i = 0; $i < $max_index; $i++ ) {
384  
385 $suffix[$i] = $empty_string;
386  
387 }
388  
389 my $index_aref = get_binding_index_aref();
390 my @index = @$index_aref;
391  
392 # label 1 in GUI is output xx_file and needs a home directory
393 $suffix[ $index[0] ] = '' . '' . '$suffix_bin';
394  
395 # label 2 in GUI is input yy_file and needs a home directory
396 $suffix[ $index[1] ] = '' . '' . '$suffix_bin';
397  
398 # label 3 in GUI is output xx_file and needs a home directory
399 $suffix[ $index[2] ] = '' . '' . '$suffix_bin';
400  
401 # label 4 in GUI is input yy_file and needs a home directory
402 $suffix[ $index[3] ] = '' . '' . '$suffix_bin';
403  
404 # label 5 in GUI is output xx_file and needs a home directory
405 $suffix[ $index[4] ] = '' . '' . '$suffix_bin';
406  
407 # label 6 in GUI is input yy_file and needs a home directory
408 $suffix[ $index[5] ] = '' . '' . '$suffix_bin';
409  
410 # label 7 in GUI is output xx_file and needs a home directory
411 $suffix[ $index[6] ] = '' . '' . '$suffix_bin';
412  
413 # label 8 in GUI is input yy_file and needs a home directory
414 $suffix[ $index[7] ] = '' . '' . '$suffix_bin';
415  
416 # label 9 in GUI is output xx_file and needs a home directory
417 $suffix[ $index[8] ] = '' . '' . '$suffix_bin';
418  
419 # label 16 in GUI is output yy_file and needs a home directory
420 $suffix[ $index[9] ] = '' . '' . '$suffix_bin';
421  
422 $elatriuni_spec->{_suffix_aref} = \@suffix;
423 return ();
424  
425 }
426  
427 =head2 sub variables
428  
429  
430 return a hash array
431 with definitions
432
433 =cut
434  
435 sub variables {
436  
437 my ($self) = @_;
438 my $hash_ref = $elatriuni_spec;
439 return ($hash_ref);
440 }
441  
442 1;