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