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

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