lib/App/SeismicUnixGui/specs/transform/suminphase_spec.pm untested

filter: Statementstmt 0.0% 0 / 129 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 17 Podpod 0.0% 0 / 13 totaltotal 0.0% 0 / 173 CC 8 SCAR 14.7
CC
8
Cov
0%
get_binding_index_aref
6.0
get_binding_length
6.0
get_file_dialog_type_aref
6.0
CRAP 4.3
1 package App::SeismicUnixGui::specs::transform::suminphase_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 $ps $segy $su $suffix_bin $suffix_ps $suffix_segy $suffix_su $suffix_txt $txt);
7 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
8  
9 my $get = L_SU_global_constants->new();
10 my $Project = Project_config->new();
11  
12 my $var = $get->var();
13  
14 my $empty_string = $var->{_empty_string};
15 my $true = $var->{_true};
16 my $false = $var->{_false};
17 my $file_dialog_type = $get->file_dialog_type_href();
18 my $flow_type = $get->flow_type_href();
19  
20 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
21 my $DATA_SEISMIC_SEGY = $Project->DATA_SEISMIC_SEGY();
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 $PS_SEISMIC = $Project->PS_SEISMIC();
26 my $max_index = 3;
27  
28  
29 my $suminphase_spec = {
30 _CONFIG => $PL_SEISMIC,
31 _DATA_DIR_IN => $DATA_SEISMIC_BIN,
32 _DATA_DIR_OUT => $DATA_SEISMIC_SU,
33 _binding_index_aref => '',
34 _suffix_type_in => $su,
35 _data_suffix_in => $suffix_su,
36 _suffix_type_out => $su,
37 _data_suffix_out => $suffix_su,
38 _file_dialog_type_aref => '',
39 _flow_type_aref => '',
40 _has_infile => $true,
41 _has_outpar => $false,
42 _has_pipe_in => $true,
43 _has_pipe_out => $true,
44 _has_redirect_in => $true,
45 _has_redirect_out => $true,
46 _has_subin_in => $false,
47 _has_subin_out => $false,
48 _is_data => $false,
49 _is_first_of_2 => $true,
50 _is_first_of_3or_more => $true,
51 _is_first_of_4or_more => $true,
52 _is_last_of_2 => $false,
53 _is_last_of_3or_more => $false,
54 _is_last_of_4or_more => $false,
55 _is_suprog => $true,
56 _is_superflow => $false,
57 _max_index => $max_index,
58 _prefix_aref => '',
59 _suffix_aref => '',
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 # e.g., first binding index (index=0)
74 # connects to third item (index=2)
75 # in the parameter list
76 # $index[0] = 1; # inbound item is bound
77 # $index[1] = 2; # inbound item is bound
78 # $index[2] = 8; # outbound item is bound
79  
80 $suminphase_spec ->{_binding_index_aref} = \@index;
81 return();
82  
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 # $type[$index[1]] = $file_dialog_type->{_Data};
105 # $type[$index[2]] = $file_dialog_type->{_Data};
106  
107 $suminphase_spec ->{_file_dialog_type_aref} = \@type;
108 return();
109  
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 $suminphase_spec ->{_flow_type_aref} = \@type;
126 return();
127  
128 }
129  
130  
131 =head2 sub get_binding_index_aref
132  
133 =cut
134  
135 sub get_binding_index_aref{
136  
137 my $self = @_;
138 my @index;
139  
140 if ($suminphase_spec->{_binding_index_aref} ) {
141  
142 my $index_aref = $suminphase_spec->{_binding_index_aref};
143 return($index_aref);
144  
145 } else {
146 print("suminphase_spec, get_binding_index_aref, missing binding_index_aref\n");
147 return();
148 }
149  
150 my $index_aref = $suminphase_spec->{_binding_index_aref};
151 }
152  
153  
154 =head2 sub get_binding_length
155  
156 =cut
157  
158 sub get_binding_length{
159  
160 my $self = @_;
161  
162 if ($suminphase_spec->{_binding_index_aref} ) {
163  
164 my $binding_length= scalar @{$suminphase_spec->{_binding_index_aref}};
165 return($binding_length);
166  
167 } else {
168 print("suminphase_spec, get_binding_length, missing binding_length\n");
169 return();
170 }
171  
172 return();
173 }
174  
175  
176 =head2 sub get_file_dialog_type_aref
177  
178 =cut
179  
180 sub get_file_dialog_type_aref{
181  
182 my $self = @_;
183 if ($suminphase_spec->{_file_dialog_type_aref} ) {
184  
185 my $index_aref = $suminphase_spec->{_file_dialog_type_aref};
186 return($index_aref);
187  
188 } else {
189 print("suminphase_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n");
190 return();
191 }
192  
193 return();
194 }
195  
196  
197 =head2 sub get_flow_type_aref
198  
199 =cut
200  
201 sub get_flow_type_aref {
202  
203 my $self = @_;
204  
205 if ($suminphase_spec->{_flow_type_aref} ) {
206  
207 my $index_aref = $suminphase_spec->{_flow_type_aref};
208 return($index_aref);
209  
210 } else {
211 print("suminphase_spec, get_flow_type_aref, missing flow_type_aref\n");
212 return();
213 }
214  
215 }
216  
217  
218 =head2 sub get_incompatibles
219  
220 =cut
221  
222 sub get_incompatibles{
223  
224 my $self = @_;
225 my @needed;
226  
227 my @_need_both;
228  
229 my @_need_only_1;
230  
231 my @_none_needed;
232  
233 my @_all_needed;
234  
235 my $params = {
236  
237 _need_both => \@_need_both,
238 _need_only_1 => \@_need_only_1,
239 _none_needed => \@_none_needed,
240 _all_needed => \@_all_needed,
241  
242 };
243  
244 my @of_two = ('xx','yy');
245 push @{$params->{_need_only_1}} , \@of_two;
246  
247 my $len_1_needed = scalar @{$params->{_need_only_1}};
248  
249 if ($len_1_needed >= 1) {
250  
251 for (my $i=0; $i < $len_1_needed; $i++) {
252  
253 print("suminphase, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n");
254  
255 }
256  
257 } else {
258 print("get_incompatibles, no incompatibles\n")
259 }
260  
261 return($params);
262  
263 }
264  
265  
266 =head2 sub get_prefix_aref
267  
268 =cut
269  
270 sub get_prefix_aref {
271  
272 my $self = @_;
273  
274 if ($suminphase_spec->{_prefix_aref} ) {
275  
276 my $prefix_aref= $suminphase_spec->{_prefix_aref};
277 return($prefix_aref);
278  
279 } else {
280 print("suminphase_spec, get_prefix_aref, missing prefix_aref\n");
281 return();
282 }
283  
284 return();
285 }
286  
287  
288 =head2 sub get_suffix_aref
289  
290 =cut
291  
292 sub get_suffix_aref {
293  
294 my $self = @_;
295  
296 if ($suminphase_spec->{_suffix_aref} ) {
297  
298 my $suffix_aref= $suminphase_spec->{_suffix_aref};
299 return($suffix_aref);
300  
301 } else {
302 print("$suminphase_spec, get_suffix_aref, missing suffix_aref\n");
303 return();
304 }
305  
306 return();
307 }
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 2 in GUI is input xx_file and needs a home directory
336 # $prefix[ $index[0] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
337  
338 # label 3 in GUI is input yy_file and needs a home directory
339 # $prefix[ $index[1] ] = '$DATA_SEISMIC_TXT' . ".'/'.";
340  
341 # label 9 in GUI is input zz_file and needs a home directory
342 # $prefix[ $index[2] ] = '$DATA_SEISMIC_SU' . ".'/'.";
343  
344 $suminphase_spec ->{_prefix_aref} = \@prefix;
345 return();
346  
347 }
348  
349  
350 =head2 sub suffix_aref
351  
352 Initialize suffixes as empty
353 values
354  
355 =cut
356  
357 sub suffix_aref {
358  
359 my $self = @_;
360  
361 my @suffix;
362  
363 for (my $i=0; $i < $max_index; $i++) {
364  
365 $suffix[$i] = $empty_string;
366  
367 }
368  
369 # my $index_aref = get_binding_index_aref();
370 # my @index = @$index_aref;
371  
372 # label 2 in GUI is input xx_file and needs a home directory
373 # $suffix[ $index[0] ] = ''.'' . '$suffix_bin';
374  
375 # label 3 in GUI is input yy_file and needs a home directory
376 # $suffix[ $index[1] ] = ''.'' . '$suffix_bin';
377  
378 # label 9 in GUI is output zz_file and needs a home directory
379 # $suffix[ $index[2] ] = ''.'' . '$suffix_su';
380  
381 $suminphase_spec ->{_suffix_aref} = \@suffix;
382 return();
383  
384 }
385  
386  
387 =head2 sub variables
388  
389  
390 return a hash array
391 with definitions
392
393 =cut
394
395 sub variables {
396  
397 my ($self) = @_;
398 my $hash_ref = $suminphase_spec;
399 return ($hash_ref);
400 }
401  
402 1;