lib/App/SeismicUnixGui/specs/header/segyclean_spec.pm untested

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