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

filter: Statementstmt 0.0% 0 / 144 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 / 189 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::suhrot_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 use aliased 'App::SeismicUnixGui::sunix::statsMath::suhrot';
9 my $get = L_SU_global_constants->new();
10 my $Project = Project_config->new();
11 my $suhrot = suhrot->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_BIN = $Project->DATA_SEISMIC_BIN();
22 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); # output data directory
23 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); # output data directory
24 my $PL_SEISMIC = $Project->PL_SEISMIC();
25 my $max_index = 8; # Insert a number here
26  
27 my $suhrot_spec = {
28 _CONFIG => $PL_SEISMIC,
29 _DATA_DIR_IN => $DATA_SEISMIC_SU,
30 _DATA_DIR_OUT => $DATA_SEISMIC_SU,
31 _binding_index_aref => '',
32 _suffix_type_in => $su,
33 _data_suffix_in => $suffix_su,
34 _suffix_type_out => $su,
35 _data_suffix_out => $suffix_su,
36 _file_dialog_type_aref => '',
37 _flow_type_aref => '',
38 _has_infile => $true,
39 _has_outpar => $false,
40 _has_pipe_in => $true,
41 _has_pipe_out => $true,
42 _has_redirect_in => $true,
43 _has_redirect_out => $true,
44 _has_subin_in => $false,
45 _has_subin_out => $false,
46 _is_data => $false,
47 _is_first_of_2 => $true,
48 _is_first_of_3or_more => $true,
49 _is_first_of_4or_more => $true,
50 _is_last_of_2 => $false,
51 _is_last_of_3or_more => $false,
52 _is_last_of_4or_more => $false,
53 _is_suprog => $true,
54 _is_superflow => $false,
55 _max_index => $max_index,
56 _prefix_aref => '',
57 _suffix_aref => '',
58 };
59  
60 =head2 sub binding_index_aref
61  
62 =cut
63  
64 sub binding_index_aref {
65  
66 my $self = @_;
67  
68 my @index;
69  
70 # first binding index (0)
71 # connects to second item (1)
72 # in the parameter list
73 $index[0] = 1;
74 $index[1] = 8;
75  
76 $suhrot_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[0] ] = $file_dialog_type->{_Data};
101  
102 $suhrot_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 $suhrot_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 ( $suhrot_spec->{_binding_index_aref} ) {
134  
135 my $index_aref = $suhrot_spec->{_binding_index_aref};
136 return ($index_aref);
137  
138 } else {
139 print("suhrot_spec, get_binding_index_aref, missing binding_index_aref\n");
140 return ();
141 }
142  
143 my $index_aref = $suhrot_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 ( $suhrot_spec->{_binding_index_aref} ) {
155  
156 my $binding_length = scalar @{ $suhrot_spec->{_binding_index_aref} };
157 return ($binding_length);
158  
159 } else {
160 print("suhrot_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 ( $suhrot_spec->{_file_dialog_type_aref} ) {
175  
176 my $index_aref = $suhrot_spec->{_file_dialog_type_aref};
177 return ($index_aref);
178  
179 } else {
180 print("suhrot_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 ( $suhrot_spec->{_flow_type_aref} ) {
196  
197 my $index_aref = $suhrot_spec->{_flow_type_aref};
198 return ($index_aref);
199  
200 } else {
201 print("suhrot_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("suhrot, 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 ( $suhrot_spec->{_prefix_aref} ) {
263  
264 my $prefix_aref = $suhrot_spec->{_prefix_aref};
265 return ($prefix_aref);
266  
267 } else {
268 print("suhrot_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 ( $suhrot_spec->{_suffix_aref} ) {
284  
285 my $suffix_aref = $suhrot_spec->{_suffix_aref};
286 return ($suffix_aref);
287  
288 } else {
289 print("$suhrot_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 9 in GUI is input yy_file and needs a home directory
325 $prefix[ $index[1] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
326  
327 $suhrot_spec->{_prefix_aref} = \@prefix;
328 return ();
329  
330 }
331  
332 =head2 sub suffix_aref
333  
334 Initialize suffixes as empty
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 2 in GUI is input xx_file and needs a home directory
355 $suffix[ $index[0] ] = '' . '' . '$suffix_bin';
356  
357 # label 9 in GUI is input yy_file and needs a home directory
358 $suffix[ $index[1] ] = '' . '' . '$suffix_su';
359  
360 $suhrot_spec->{_suffix_aref} = \@suffix;
361 return ();
362  
363 }
364  
365 =head2 sub variables
366  
367  
368 return a hash array
369 with definitions
370
371 =cut
372  
373 sub variables {
374  
375 my ($self) = @_;
376 my $hash_ref = $suhrot_spec;
377 return ($hash_ref);
378 }
379  
380 1;