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

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