lib/App/SeismicUnixGui/specs/migration/sumigffd_spec.pm untested

filter: Statementstmt 0.0% 0 / 140 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 / 185 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::migration::sumigffd_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::migration::sumigffd';
10 my $get = L_SU_global_constants->new();
11 my $Project = Project_config->new();
12 my $sumigffd = sumigffd->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 = 7;
29  
30 my $sumigffd_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] = 7; # inbound item is bound
77  
78 # $index[1] = 2; # inbound item is bound
79 # $index[2] = 8; # outbound item is bound
80  
81 $sumigffd_spec->{_binding_index_aref} = \@index;
82 return ();
83  
84 }
85  
86 =head2 sub file_dialog_type_aref
87  
88 type of dialog (Data, Flow, SaveAs) is needed by binding
89 one type of dialog for each index
90 =cut
91  
92 sub file_dialog_type_aref {
93  
94 my $self = @_;
95  
96 my @type;
97  
98 my $index_aref = get_binding_index_aref();
99 my @index = @$index_aref;
100  
101 # bound index will look for data
102 # $type[0] = '';
103 $type[ $index[0] ] = $file_dialog_type->{_Data};
104  
105 # $type[$index[1]] = $file_dialog_type->{_Data};
106 # $type[$index[2]] = $file_dialog_type->{_Data};
107  
108 $sumigffd_spec->{_file_dialog_type_aref} = \@type;
109 return ();
110  
111 }
112  
113 =head2 sub flow_type_aref
114  
115 =cut
116  
117 sub flow_type_aref {
118  
119 my $self = @_;
120  
121 my @type;
122  
123 $type[0] = $flow_type->{_user_built};
124  
125 $sumigffd_spec->{_flow_type_aref} = \@type;
126 return ();
127  
128 }
129  
130 =head2 sub get_binding_index_aref
131  
132 =cut
133  
134 sub get_binding_index_aref {
135  
136 my $self = @_;
137 my @index;
138  
139 if ( $sumigffd_spec->{_binding_index_aref} ) {
140  
141 my $index_aref = $sumigffd_spec->{_binding_index_aref};
142 return ($index_aref);
143  
144 }
145 else {
146 print(
147 "sumigffd_spec, get_binding_index_aref, missing binding_index_aref\n"
148 );
149 return ();
150 }
151  
152 my $index_aref = $sumigffd_spec->{_binding_index_aref};
153 }
154  
155 =head2 sub get_binding_length
156  
157 =cut
158  
159 sub get_binding_length {
160  
161 my $self = @_;
162  
163 if ( $sumigffd_spec->{_binding_index_aref} ) {
164  
165 my $binding_length = scalar @{ $sumigffd_spec->{_binding_index_aref} };
166 return ($binding_length);
167  
168 }
169 else {
170 print("sumigffd_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 ( $sumigffd_spec->{_file_dialog_type_aref} ) {
185  
186 my $index_aref = $sumigffd_spec->{_file_dialog_type_aref};
187 return ($index_aref);
188  
189 }
190 else {
191 print(
192 "sumigffd_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n"
193 );
194 return ();
195 }
196  
197 return ();
198 }
199  
200 =head2 sub get_flow_type_aref
201  
202 =cut
203  
204 sub get_flow_type_aref {
205  
206 my $self = @_;
207  
208 if ( $sumigffd_spec->{_flow_type_aref} ) {
209  
210 my $index_aref = $sumigffd_spec->{_flow_type_aref};
211 return ($index_aref);
212  
213 }
214 else {
215 print("sumigffd_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(
257 "sumigffd, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n"
258 );
259  
260 }
261  
262 }
263 else {
264 print("get_incompatibles, no incompatibles\n");
265 }
266  
267 return ($params);
268  
269 }
270  
271 =head2 sub get_prefix_aref
272  
273 =cut
274  
275 sub get_prefix_aref {
276  
277 my $self = @_;
278  
279 if ( $sumigffd_spec->{_prefix_aref} ) {
280  
281 my $prefix_aref = $sumigffd_spec->{_prefix_aref};
282 return ($prefix_aref);
283  
284 }
285 else {
286 print("sumigffd_spec, get_prefix_aref, missing prefix_aref\n");
287 return ();
288 }
289  
290 return ();
291 }
292  
293 =head2 sub get_suffix_aref
294  
295 =cut
296  
297 sub get_suffix_aref {
298  
299 my $self = @_;
300  
301 if ( $sumigffd_spec->{_suffix_aref} ) {
302  
303 my $suffix_aref = $sumigffd_spec->{_suffix_aref};
304 return ($suffix_aref);
305  
306 }
307 else {
308 print("$sumigffd_spec, get_suffix_aref, missing suffix_aref\n");
309 return ();
310 }
311  
312 return ();
313 }
314  
315 =head2 sub prefix_aref
316  
317 Include in the Set up
318 sections of an output Poop flow.
319  
320 prefixes and suffixes to parameter labels
321 are filtered by sunix_pl
322  
323 =cut
324  
325 sub prefix_aref {
326  
327 my $self = @_;
328  
329 my @prefix;
330  
331 for ( my $i = 0 ; $i < $max_index ; $i++ ) {
332  
333 $prefix[$i] = $empty_string;
334  
335 }
336  
337 my $index_aref = get_binding_index_aref();
338 my @index = @$index_aref;
339  
340 # label 8 in GUI is input xx_file and needs a home directory
341 $prefix[ $index[0] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
342  
343 # label 3 in GUI is input yy_file and needs a home directory
344 # $prefix[ $index[1] ] = '$DATA_SEISMIC_TXT' . ".'/'.";
345  
346 # label 9 in GUI is input zz_file and needs a home directory
347 # $prefix[ $index[2] ] = '$DATA_SEISMIC_SU' . ".'/'.";
348  
349 $sumigffd_spec->{_prefix_aref} = \@prefix;
350 return ();
351  
352 }
353  
354 =head2 sub suffix_aref
355  
356 Initialize suffixes as empty
357 values
358  
359 =cut
360  
361 sub suffix_aref {
362  
363 my $self = @_;
364  
365 my @suffix;
366  
367 for ( my $i = 0 ; $i < $max_index ; $i++ ) {
368  
369 $suffix[$i] = $empty_string;
370  
371 }
372  
373 my $index_aref = get_binding_index_aref();
374 my @index = @$index_aref;
375  
376 # label 8 in GUI is input xx_file and needs a home directory
377 $suffix[ $index[0] ] = '' . '' . '$suffix_bin';
378  
379 # label 3 in GUI is input yy_file and needs a home directory
380 # $suffix[ $index[1] ] = ''.'' . '$suffix_bin';
381  
382 # label 9 in GUI is output zz_file and needs a home directory
383 # $suffix[ $index[2] ] = ''.'' . '$suffix_su';
384  
385 $sumigffd_spec->{_suffix_aref} = \@suffix;
386 return ();
387  
388 }
389  
390 =head2 sub variables
391  
392  
393 return a hash array
394 with definitions
395
396 =cut
397  
398 sub variables {
399  
400 my ($self) = @_;
401 my $hash_ref = $sumigffd_spec;
402 return ($hash_ref);
403 }
404  
405 1;