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