lib/App/SeismicUnixGui/specs/model/suremel2dan_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::suremel2dan_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::suremel2dan';
9 my $get = L_SU_global_constants->new();
10 my $Project = Project_config->new();
11 my $suremel2dan = suremel2dan->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 = 47;
26  
27 my $suremel2dan_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] = 3; # inbound item is bound
74 $index[1] = 4; # inbound item is bound
75 $index[2] = 5; # inbound item is bound
76 $index[3] = 6; # inbound item is bound
77 $index[4] = 7; # inbound item is bound
78 $index[5] = 8; # inbound item is bound
79 $index[6] = 9; # inbound item is bound
80 $index[7] = 33; # inbound item is bound
81 $index[8] = 42; # oinbound item is bound
82 $index[9] = 43; # inbound item is bound
83  
84 $suremel2dan_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  
117 $suremel2dan_spec->{_file_dialog_type_aref} = \@type;
118 return ();
119  
120 }
121  
122 =head2 sub flow_type_aref
123  
124 =cut
125  
126 sub flow_type_aref {
127  
128 my $self = @_;
129  
130 my @type;
131  
132 $type[0] = $flow_type->{_user_built};
133  
134 $suremel2dan_spec->{_flow_type_aref} = \@type;
135 return ();
136  
137 }
138  
139 =head2 sub get_binding_index_aref
140  
141 =cut
142  
143 sub get_binding_index_aref {
144  
145 my $self = @_;
146 my @index;
147  
148 if ( $suremel2dan_spec->{_binding_index_aref} ) {
149  
150 my $index_aref = $suremel2dan_spec->{_binding_index_aref};
151 return ($index_aref);
152  
153 } else {
154 print("suremel2dan_spec, get_binding_index_aref, missing binding_index_aref\n");
155 return ();
156 }
157  
158 my $index_aref = $suremel2dan_spec->{_binding_index_aref};
159 }
160  
161 =head2 sub get_binding_length
162  
163 =cut
164  
165 sub get_binding_length {
166  
167 my $self = @_;
168  
169 if ( $suremel2dan_spec->{_binding_index_aref} ) {
170  
171 my $binding_length = scalar @{ $suremel2dan_spec->{_binding_index_aref} };
172 return ($binding_length);
173  
174 } else {
175 print("suremel2dan_spec, get_binding_length, missing binding_length\n");
176 return ();
177 }
178  
179 return ();
180 }
181  
182 =head2 sub get_file_dialog_type_aref
183  
184 =cut
185  
186 sub get_file_dialog_type_aref {
187  
188 my $self = @_;
189 if ( $suremel2dan_spec->{_file_dialog_type_aref} ) {
190  
191 my $index_aref = $suremel2dan_spec->{_file_dialog_type_aref};
192 return ($index_aref);
193  
194 } else {
195 print("suremel2dan_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n");
196 return ();
197 }
198  
199 return ();
200 }
201  
202 =head2 sub get_flow_type_aref
203  
204 =cut
205  
206 sub get_flow_type_aref {
207  
208 my $self = @_;
209  
210 if ( $suremel2dan_spec->{_flow_type_aref} ) {
211  
212 my $index_aref = $suremel2dan_spec->{_flow_type_aref};
213 return ($index_aref);
214  
215 } else {
216 print("suremel2dan_spec, get_flow_type_aref, missing flow_type_aref\n");
217 return ();
218 }
219  
220 }
221  
222 =head2 sub get_incompatibles
223  
224 =cut
225  
226 sub get_incompatibles {
227  
228 my $self = @_;
229 my @needed;
230  
231 my @_need_both;
232  
233 my @_need_only_1;
234  
235 my @_none_needed;
236  
237 my @_all_needed;
238  
239 my $params = {
240  
241 _need_both => \@_need_both,
242 _need_only_1 => \@_need_only_1,
243 _none_needed => \@_none_needed,
244 _all_needed => \@_all_needed,
245  
246 };
247  
248 my @of_two = ( 'xx', 'yy' );
249 push @{ $params->{_need_only_1} }, \@of_two;
250  
251 my $len_1_needed = scalar @{ $params->{_need_only_1} };
252  
253 if ( $len_1_needed >= 1 ) {
254  
255 for ( my $i = 0; $i < $len_1_needed; $i++ ) {
256  
257 print("suremel2dan, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n");
258  
259 }
260  
261 } else {
262 print("get_incompatibles, no incompatibles\n");
263 }
264  
265 return ($params);
266  
267 }
268  
269 =head2 sub get_prefix_aref
270  
271 =cut
272  
273 sub get_prefix_aref {
274  
275 my $self = @_;
276  
277 if ( $suremel2dan_spec->{_prefix_aref} ) {
278  
279 my $prefix_aref = $suremel2dan_spec->{_prefix_aref};
280 return ($prefix_aref);
281  
282 } else {
283 print("suremel2dan_spec, get_prefix_aref, missing prefix_aref\n");
284 return ();
285 }
286  
287 return ();
288 }
289  
290 =head2 sub get_suffix_aref
291  
292 =cut
293  
294 sub get_suffix_aref {
295  
296 my $self = @_;
297  
298 if ( $suremel2dan_spec->{_suffix_aref} ) {
299  
300 my $suffix_aref = $suremel2dan_spec->{_suffix_aref};
301 return ($suffix_aref);
302  
303 } else {
304 print("$suremel2dan_spec, get_suffix_aref, missing suffix_aref\n");
305 return ();
306 }
307  
308 return ();
309 }
310  
311 =head2 sub prefix_aref
312  
313 Include in the Set up
314 sections of an output Poop flow.
315  
316 prefixes and suffixes to parameter labels
317 are filtered by sunix_pl
318  
319 =cut
320  
321 sub prefix_aref {
322  
323 my $self = @_;
324  
325 my @prefix;
326  
327 for ( my $i = 0; $i < $max_index; $i++ ) {
328  
329 $prefix[$i] = $empty_string;
330  
331 }
332  
333 my $index_aref = get_binding_index_aref();
334 my @index = @$index_aref;
335 # label 4 in GUI is input xx_file and needs a home directory
336 $prefix[ $index[0] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
337  
338 # label 5 in GUI is input yy_file and needs a home directory
339 $prefix[ $index[1] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
340  
341 # label 6 in GUI is input zz_file and needs a home directory
342 $prefix[ $index[2] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
343  
344 # label 7 in GUI is input xx_file and needs a home directory
345 $prefix[ $index[3] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
346  
347 # label 8 in GUI is input yy_file and needs a home directory
348 $prefix[ $index[4] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
349  
350 # label 9 in GUI is input xx_file and needs a home directory
351 $prefix[ $index[5] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
352  
353 # label 10 in GUI is input yy_file and needs a home directory
354 $prefix[ $index[6] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
355  
356 # label 35 in GUI is input zz_file and needs a home directory
357 $prefix[ $index[7] ] = '$DATA_SEISMIC_SU' . ".'/'.";
358  
359 # label 44 in GUI is input xx_file and needs a home directory
360 $prefix[ $index[8] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
361  
362 # label 45 in GUI is input yy_file and needs a home directory
363 $prefix[ $index[9] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
364  
365 $suremel2dan_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 4 in GUI is input xx_file and needs a home directory
393 $suffix[ $index[0] ] = '' . '' . '$suffix_bin';
394  
395 # label 5 in GUI is input yy_file and needs a home directory
396 $suffix[ $index[1] ] = '' . '' . '$suffix_bin';
397  
398 # label 6 in GUI is input zz_file and needs a home directory
399 $suffix[ $index[2] ] = '' . '' . '$suffix_bin';
400  
401 # label 7 in GUI is input xx_file and needs a home directory
402 $suffix[ $index[3] ] = '' . '' . '$suffix_bin';
403  
404 # label 8 in GUI is input yy_file and needs a home directory
405 $suffix[ $index[4] ] = '' . '' . '$suffix_bin';
406  
407 # label 9 in GUI is input zz_file and needs a home directory
408 $suffix[ $index[5] ] = '' . '' . '$suffix_bin';
409  
410 # label 10 in GUI is input xx_file and needs a home directory
411 $suffix[ $index[6] ] = '' . '' . '$suffix_bin';
412  
413 # label 35 in GUI is input yy_file and needs a home directory
414 $suffix[ $index[7] ] = '' . '' . '$suffix_su';
415  
416 # label 44 in GUI is input zz_file and needs a home directory
417 $suffix[ $index[8] ] = '' . '' . '$suffix_bin';
418  
419 # label 45 in GUI is input xx_file and needs a home directory
420 $suffix[ $index[9] ] = '' . '' . '$suffix_bin';
421  
422 $suremel2dan_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 = $suremel2dan_spec;
439 return ($hash_ref);
440 }
441  
442 1;