lib/App/SeismicUnixGui/specs/header/suresstat_spec.pm untested

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