lib/App/SeismicUnixGui/specs/well/subackus_spec.pm untested

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