lib/App/SeismicUnixGui/specs/filter/sucddecon_spec.pm untested

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