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

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