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

filter: Statementstmt 0.0% 0 / 124 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 / 168 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::sumax_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);
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(); # input data directory
21 my $PL_SEISMIC = $Project->PL_SEISMIC();
22 my $max_index = 7;
23  
24 my $sumax_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_pipe_in => $true,
37 _has_outpar => $false,
38 _has_pipe_out => $true,
39 _has_redirect_in => $true,
40 _has_redirect_out => $true,
41 _has_subin_in => $false, #can do
42 _has_subin_out => $false, #can do
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 => $true,
48 _is_last_of_3or_more => $true,
49 _is_last_of_4or_more => $true,
50 _is_suprog => $true,
51 _is_superflow => $false,
52 _max_index => $max_index,
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 $index[0] = 0;
66  
67 $sumax_spec->{_binding_index_aref} = \@index;
68 return ();
69  
70 }
71  
72 =head2 sub file_dialog_type_aref
73  
74 type of dialog (Data, Flow, SaveAs) is needed by binding
75 one type of dialog for each index
76  
77 =cut
78  
79 sub file_dialog_type_aref {
80  
81 my ($self) = @_;
82  
83 my @type;
84  
85 $type[0] = '';
86  
87 $sumax_spec->{_file_dialog_type_aref} = \@type;
88 return ();
89  
90 }
91  
92 =head2 sub flow_type_aref
93  
94 =cut
95  
96 sub flow_type_aref {
97  
98 my ($self) = @_;
99  
100 my @type;
101  
102 $type[0] = $flow_type->{_user_built};
103  
104 $sumax_spec->{_flow_type_aref} = \@type;
105 return ();
106  
107 }
108  
109 =head2 sub get_binding_index_aref
110  
111 =cut
112  
113 sub get_binding_index_aref {
114  
115 my ($self) = @_;
116 my @index;
117  
118 if ( $sumax_spec->{_binding_index_aref} ) {
119  
120 my $index_aref = $sumax_spec->{_binding_index_aref};
121 return ($index_aref);
122  
123 }
124 else {
125 print(
126 "sumax_spec, get_binding_index_aref, missing binding_index_aref\n"
127 );
128 return ();
129 }
130  
131 my $index_aref = $sumax_spec->{_binding_index_aref};
132 }
133  
134 =head2 sub get_binding_length
135  
136 =cut
137  
138 sub get_binding_length {
139  
140 my ($self) = @_;
141  
142 if ( $sumax_spec->{_binding_index_aref} ) {
143  
144 my $binding_length = scalar @{ $sumax_spec->{_binding_index_aref} };
145 return ($binding_length);
146  
147 }
148 else {
149 print("sumax_spec, get_binding_length, missing binding_length\n");
150 return ();
151 }
152  
153 return ();
154 }
155  
156 =head2 sub get_file_dialog_type_aref
157  
158 =cut
159  
160 sub get_file_dialog_type_aref {
161  
162 my ($self) = @_;
163 if ( $sumax_spec->{_file_dialog_type_aref} ) {
164  
165 my $index_aref = $sumax_spec->{_file_dialog_type_aref};
166 return ($index_aref);
167  
168 }
169 else {
170 print(
171 "sumax_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n"
172 );
173 return ();
174 }
175  
176 return ();
177 }
178  
179 =head2 sub get_flow_type_aref
180  
181 =cut
182  
183 sub get_flow_type_aref {
184  
185 my ($self) = @_;
186  
187 if ( $sumax_spec->{_flow_type_aref} ) {
188  
189 my $index_aref = $sumax_spec->{_flow_type_aref};
190 return ($index_aref);
191  
192 }
193 else {
194 print("sumax_spec, get_flow_type_aref, missing flow_type_aref\n");
195 return ();
196 }
197  
198 }
199  
200 =head2 sub get_incompatibles
201  
202 =cut
203  
204 sub get_incompatibles {
205  
206 my ($self) = @_;
207 my @needed;
208  
209 my @_need_both;
210  
211 my @_need_only_1;
212  
213 my @_none_needed;
214  
215 my @_all_needed;
216  
217 my $params = {
218  
219 _need_both => \@_need_both,
220 _need_only_1 => \@_need_only_1,
221 _none_needed => \@_none_needed,
222 _all_needed => \@_all_needed,
223  
224 };
225  
226 my @of_two = ( 'xx', 'yy' );
227 push @{ $params->{_need_only_1} }, \@of_two;
228  
229 my $len_1_needed = scalar @{ $params->{_need_only_1} };
230  
231 if ( $len_1_needed >= 1 ) {
232  
233 for ( my $i = 0 ; $i < $len_1_needed ; $i++ ) {
234  
235 print(
236 "sumax, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n"
237 );
238  
239 }
240  
241 }
242 else {
243 print("get_incompatibles, no incompatibles\n");
244 }
245  
246 return ($params);
247  
248 }
249  
250 =head2 sub get_prefix_aref
251  
252 =cut
253  
254 sub get_prefix_aref {
255  
256 my ($self) = @_;
257  
258 if ( $sumax_spec->{_prefix_aref} ) {
259  
260 my $prefix_aref = $sumax_spec->{_prefix_aref};
261 return ($prefix_aref);
262  
263 }
264 else {
265 print("sumax_spec, get_prefix_aref, missing prefix_aref\n");
266 return ();
267 }
268  
269 return ();
270 }
271  
272 =head2 sub get_suffix_aref
273  
274 =cut
275  
276 sub get_suffix_aref {
277  
278 my ($self) = @_;
279  
280 if ( $sumax_spec->{_suffix_aref} ) {
281  
282 my $suffix_aref = $sumax_spec->{_suffix_aref};
283 return ($suffix_aref);
284  
285 }
286 else {
287 print("$sumax_spec, get_suffix_aref, missing suffix_aref\n");
288 return ();
289 }
290  
291 return ();
292 }
293  
294 =head2 sub prefix_aref
295  
296 Include in the Set up
297 sections of an output Poop flow.
298  
299 prefixes and suffixes to parameter labels
300 are filtered by sunix_pl
301  
302 =cut
303  
304 sub prefix_aref {
305  
306 my ($self) = @_;
307  
308 my @prefix;
309  
310 for ( my $i = 0 ; $i < $max_index ; $i++ ) {
311  
312 $prefix[$i] = $empty_string;
313  
314 }
315 $sumax_spec->{_prefix_aref} = \@prefix;
316 return ();
317  
318 }
319  
320 =head2 sub suffix_aref
321  
322 Initialize suffixes as empty
323 Assign specific suffixes to parameter
324 values
325  
326 =cut
327  
328 sub suffix_aref {
329  
330 my ($self) = @_;
331  
332 my @suffix;
333  
334 for ( my $i = 0 ; $i < $max_index ; $i++ ) {
335  
336 $suffix[$i] = $empty_string;
337  
338 }
339 $sumax_spec->{_suffix_aref} = \@suffix;
340 return ();
341  
342 }
343  
344 =head2 sub variables
345  
346 return a hash array
347 with definitions
348
349 =cut
350  
351 sub variables {
352 my $self = @_;
353 my $hash_ref = $sumax_spec;
354 return ($hash_ref);
355 }
356  
357 1;