lib/App/SeismicUnixGui/specs/datum/sukdmdcr_spec.pm untested

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