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

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