lib/App/SeismicUnixGui/specs/shapeNcut/suramp_spec.pm untested

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