lib/App/SeismicUnixGui/specs/statsMath/sumean_spec.pm untested

filter: Statementstmt 0.0% 0 / 134 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 / 178 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::statsMath::sumean_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 $su $suffix_bin $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_SU = $Project->DATA_SEISMIC_SU(); # output data directory
22 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); # output data directory
23 my $PL_SEISMIC = $Project->PL_SEISMIC();
24 my $max_index = 3; # Insert a number here
25  
26 my $sumean_spec = {
27 _CONFIG => $PL_SEISMIC,
28 _DATA_DIR_IN => $DATA_SEISMIC_BIN,
29 _DATA_DIR_OUT => $DATA_SEISMIC_SU,
30 _binding_index_aref => '',
31 _suffix_type_in => $su,
32 _data_suffix_in => $suffix_su,
33 _suffix_type_out => $su,
34 _data_suffix_out => $suffix_su,
35 _file_dialog_type_aref => '',
36 _flow_type_aref => '',
37 _has_infile => $true,
38 _has_outpar => $false,
39 _has_pipe_in => $true,
40 _has_pipe_out => $true,
41 _has_redirect_in => $true,
42 _has_redirect_out => $true,
43 _has_subin_in => $false,
44 _has_subin_out => $false,
45 _is_data => $false,
46 _is_first_of_2 => $true,
47 _is_first_of_3or_more => $true,
48 _is_first_of_4or_more => $true,
49 _is_last_of_2 => $false,
50 _is_last_of_3or_more => $false,
51 _is_last_of_4or_more => $false,
52 _is_suprog => $true,
53 _is_superflow => $false,
54 _max_index => $max_index,
55 _prefix_aref => '',
56 _suffix_aref => '',
57 };
58  
59 =head2 sub binding_index_aref
60  
61 =cut
62  
63 sub binding_index_aref {
64  
65 my $self = @_;
66  
67 my @index;
68  
69 # first binding index (0)
70 # connects to second item (1)
71 # in the parameter list
72 # $index[0] = 1; # inbound item is bound
73 # $index[1] = 2; # inbound item is bound to
74 # $index[2] = 8; # outbound item is bound to
75  
76 $sumean_spec->{_binding_index_aref} = \@index;
77 return ();
78  
79 }
80  
81 =head2 sub file_dialog_type_aref
82  
83 type of dialog (Data, Flow, SaveAs) is needed by binding
84 one type of dialog for each index
85 =cut
86  
87 sub file_dialog_type_aref {
88  
89 my $self = @_;
90  
91 my @type;
92  
93 my $index_aref = get_binding_index_aref();
94 my @index = @$index_aref;
95  
96 # bound index will look for data
97 # $type[0] = '';
98 $type[ $index[0] ] = $file_dialog_type->{_Data};
99 $type[ $index[1] ] = $file_dialog_type->{_Data};
100 $type[ $index[2] ] = $file_dialog_type->{_Data};
101  
102 $sumean_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 $sumean_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 ( $sumean_spec->{_binding_index_aref} ) {
134  
135 my $index_aref = $sumean_spec->{_binding_index_aref};
136 return ($index_aref);
137  
138 } else {
139 print("sumean_spec, get_binding_index_aref, missing binding_index_aref\n");
140 return ();
141 }
142  
143 my $index_aref = $sumean_spec->{_binding_index_aref};
144 }
145  
146 =head2 sub get_binding_length
147  
148 =cut
149  
150 sub get_binding_length {
151  
152 my $self = @_;
153  
154 if ( $sumean_spec->{_binding_index_aref} ) {
155  
156 my $binding_length = scalar @{ $sumean_spec->{_binding_index_aref} };
157 return ($binding_length);
158  
159 } else {
160 print("sumean_spec, get_binding_length, missing binding_length\n");
161 return ();
162 }
163  
164 return ();
165 }
166  
167 =head2 sub get_file_dialog_type_aref
168  
169 =cut
170  
171 sub get_file_dialog_type_aref {
172  
173 my $self = @_;
174 if ( $sumean_spec->{_file_dialog_type_aref} ) {
175  
176 my $index_aref = $sumean_spec->{_file_dialog_type_aref};
177 return ($index_aref);
178  
179 } else {
180 print("sumean_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n");
181 return ();
182 }
183  
184 return ();
185 }
186  
187 =head2 sub get_flow_type_aref
188  
189 =cut
190  
191 sub get_flow_type_aref {
192  
193 my $self = @_;
194  
195 if ( $sumean_spec->{_flow_type_aref} ) {
196  
197 my $index_aref = $sumean_spec->{_flow_type_aref};
198 return ($index_aref);
199  
200 } else {
201 print("sumean_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("sumean, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n");
243  
244 }
245  
246 } else {
247 print("get_incompatibles, no incompatibles\n");
248 }
249  
250 return ($params);
251  
252 }
253  
254 =head2 sub get_prefix_aref
255  
256 =cut
257  
258 sub get_prefix_aref {
259  
260 my $self = @_;
261  
262 if ( $sumean_spec->{_prefix_aref} ) {
263  
264 my $prefix_aref = $sumean_spec->{_prefix_aref};
265 return ($prefix_aref);
266  
267 } else {
268 print("sumean_spec, get_prefix_aref, missing prefix_aref\n");
269 return ();
270 }
271  
272 return ();
273 }
274  
275 =head2 sub get_suffix_aref
276  
277 =cut
278  
279 sub get_suffix_aref {
280  
281 my $self = @_;
282  
283 if ( $sumean_spec->{_suffix_aref} ) {
284  
285 my $suffix_aref = $sumean_spec->{_suffix_aref};
286 return ($suffix_aref);
287  
288 } else {
289 print("$sumean_spec, get_suffix_aref, missing suffix_aref\n");
290 return ();
291 }
292  
293 return ();
294 }
295  
296 =head2 sub prefix_aref
297  
298 Include in the Set up
299 sections of an output Poop flow.
300  
301 prefixes and suffixes to parameter labels
302 are filtered by sunix_pl
303  
304 =cut
305  
306 sub prefix_aref {
307  
308 my $self = @_;
309  
310 my @prefix;
311  
312 for ( my $i = 0; $i < $max_index; $i++ ) {
313  
314 $prefix[$i] = $empty_string;
315  
316 }
317  
318 my $index_aref = get_binding_index_aref();
319 my @index = @$index_aref;
320  
321 # label 2 in GUI is input xx_file and needs a home directory
322 $prefix[ $index[0] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
323  
324 # label 3 in GUI is input yy_file and needs a home directory
325 $prefix[ $index[1] ] = '$DATA_SEISMIC_TXT' . ".'/'.";
326  
327 # label 9 in GUI is input zz_file and needs a home directory
328 $prefix[ $index[2] ] = '$DATA_SEISMIC_SU' . ".'/'.";
329  
330 $sumean_spec->{_prefix_aref} = \@prefix;
331 return ();
332  
333 }
334  
335 =head2 sub suffix_aref
336  
337 Initialize suffixes as empty
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 # my $index_aref = get_binding_index_aref();
355 # my @index = @$index_aref;
356 #
357 # # label 2 in GUI is input xx_file and needs a home directory
358 # $suffix[ $index[0] ] = ''.'' . '$suffix_bin';
359 #
360 # # label 3 in GUI is input yy_file and needs a home directory
361 # $suffix[ $index[1] ] = ''.'' . '$suffix_bin';
362 #
363 # # label 9 in GUI is output zz_file and needs a home directory
364 # $suffix[ $index[2] ] = ''.'' . '$suffix_su';
365  
366 $sumean_spec->{_suffix_aref} = \@suffix;
367 return ();
368  
369 }
370  
371 =head2 sub variables
372  
373  
374 return a hash array
375 with definitions
376
377 =cut
378  
379 sub variables {
380  
381 my ($self) = @_;
382 my $hash_ref = $sumean_spec;
383 return ($hash_ref);
384 }
385  
386 1;