lib/App/SeismicUnixGui/specs/data/supack2_spec.pm untested

filter: Statementstmt 0.0% 0 / 132 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 / 177 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::data::supack2_spec;
2 use Moose;
3 our $VERSION = '0.0.1';
4  
5 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
6 use aliased 'App::SeismicUnixGui::specs::data::supack2_spec';
7 use App::SeismicUnixGui::misc::SeismicUnix qw($bin $segy $su $suffix_bin $suffix_segy $suffix_su $suffix_txt $txt);
8 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
9  
10 my $get = L_SU_global_constants->new();
11 my $Project = Project_config->new();
12 my $supack2 = supack2->new();
13  
14 my $var = $get->var();
15  
16 my $empty_string = $var->{_empty_string};
17 my $true = $var->{_true};
18 my $false = $var->{_false};
19 my $file_dialog_type = $get->file_dialog_type_href();
20 my $flow_type = $get->flow_type_href();
21  
22 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
23 my $DATA_SEISMIC_SEGY = $Project->DATA_SEISMIC_SEGY(); # output data directory
24 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); # output data directory
25 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); # output data directory
26 my $PL_SEISMIC = $Project->PL_SEISMIC();
27 my $max_index = 0;
28  
29 my $supack2_spec = {
30 _CONFIG => $PL_SEISMIC,
31 _DATA_DIR_IN => $DATA_SEISMIC_SEGY,
32 _DATA_DIR_OUT => $DATA_SEISMIC_SEGY,
33 _binding_index_aref => '',
34 _suffix_type_in => $segy,
35 _data_suffix_in => $suffix_segy,
36 _suffix_type_out => $segy,
37 _data_suffix_out => $suffix_segy,
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 =head2 sub binding_index_aref
63  
64 =cut
65  
66 sub binding_index_aref {
67  
68 my $self = @_;
69  
70 my @index;
71  
72 # first binding index (index=0)
73 # connects to second item (index=1)
74 # in the parameter list
75 # $index[0] = 1; # inbound item is bound
76 # $index[1] = 2; # inbound item is bound
77 # $index[2] = 8; # outbound item is bound
78  
79 $supack2_spec->{_binding_index_aref} = \@index;
80 return ();
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  
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  
106 $supack2_spec->{_file_dialog_type_aref} = \@type;
107 return ();
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 $supack2_spec->{_flow_type_aref} = \@type;
124 return ();
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 ( $supack2_spec->{_binding_index_aref} ) {
138  
139 my $index_aref = $supack2_spec->{_binding_index_aref};
140 return ($index_aref);
141  
142 } else {
143 print("supack2_spec, get_binding_index_aref, missing binding_index_aref\n");
144 return ();
145 }
146  
147 my $index_aref = $supack2_spec->{_binding_index_aref};
148 }
149  
150 =head2 sub get_binding_length
151  
152 =cut
153  
154 sub get_binding_length {
155  
156 my $self = @_;
157  
158 if ( $supack2_spec->{_binding_index_aref} ) {
159  
160 my $binding_length = scalar @{ $supack2_spec->{_binding_index_aref} };
161 return ($binding_length);
162  
163 } else {
164 print("supack2_spec, get_binding_length, missing binding_length\n");
165 return ();
166 }
167  
168 return ();
169 }
170  
171 =head2 sub get_file_dialog_type_aref
172  
173 =cut
174  
175 sub get_file_dialog_type_aref {
176  
177 my $self = @_;
178 if ( $supack2_spec->{_file_dialog_type_aref} ) {
179  
180 my $index_aref = $supack2_spec->{_file_dialog_type_aref};
181 return ($index_aref);
182  
183 } else {
184 print("supack2_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n");
185 return ();
186 }
187  
188 return ();
189 }
190  
191 =head2 sub get_flow_type_aref
192  
193 =cut
194  
195 sub get_flow_type_aref {
196  
197 my $self = @_;
198  
199 if ( $supack2_spec->{_flow_type_aref} ) {
200  
201 my $index_aref = $supack2_spec->{_flow_type_aref};
202 return ($index_aref);
203  
204 } else {
205 print("supack2_spec, get_flow_type_aref, missing flow_type_aref\n");
206 return ();
207 }
208  
209 }
210  
211 =head2 sub get_incompatibles
212  
213 =cut
214  
215 sub get_incompatibles {
216  
217 my $self = @_;
218 my @needed;
219  
220 my @_need_both;
221  
222 my @_need_only_1;
223  
224 my @_none_needed;
225  
226 my @_all_needed;
227  
228 my $params = {
229  
230 _need_both => \@_need_both,
231 _need_only_1 => \@_need_only_1,
232 _none_needed => \@_none_needed,
233 _all_needed => \@_all_needed,
234  
235 };
236  
237 my @of_two = ( 'xx', 'yy' );
238 push @{ $params->{_need_only_1} }, \@of_two;
239  
240 my $len_1_needed = scalar @{ $params->{_need_only_1} };
241  
242 if ( $len_1_needed >= 1 ) {
243  
244 for ( my $i = 0; $i < $len_1_needed; $i++ ) {
245  
246 print("supack2, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n");
247  
248 }
249  
250 } else {
251 print("get_incompatibles, no incompatibles\n");
252 }
253  
254 return ($params);
255  
256 }
257  
258 =head2 sub get_prefix_aref
259  
260 =cut
261  
262 sub get_prefix_aref {
263  
264 my $self = @_;
265  
266 if ( $supack2_spec->{_prefix_aref} ) {
267  
268 my $prefix_aref = $supack2_spec->{_prefix_aref};
269 return ($prefix_aref);
270  
271 } else {
272 print("supack2_spec, get_prefix_aref, missing prefix_aref\n");
273 return ();
274 }
275  
276 return ();
277 }
278  
279 =head2 sub get_suffix_aref
280  
281 =cut
282  
283 sub get_suffix_aref {
284  
285 my $self = @_;
286  
287 if ( $supack2_spec->{_suffix_aref} ) {
288  
289 my $suffix_aref = $supack2_spec->{_suffix_aref};
290 return ($suffix_aref);
291  
292 } else {
293 print("$supack2_spec, get_suffix_aref, missing suffix_aref\n");
294 return ();
295 }
296  
297 return ();
298 }
299  
300 =head2 sub prefix_aref
301  
302 Include in the Set up
303 sections of an output Poop flow.
304  
305 prefixes and suffixes to parameter labels
306 are filtered by sunix_pl
307  
308 =cut
309  
310 sub prefix_aref {
311  
312 my $self = @_;
313  
314 my @prefix;
315  
316 for ( my $i = 0; $i < $max_index; $i++ ) {
317  
318 $prefix[$i] = $empty_string;
319  
320 }
321  
322 # my $index_aref = get_binding_index_aref();
323 # my @index = @$index_aref;
324 #
325 # # label 2 in GUI is input xx_file and needs a home directory
326 # $prefix[ $index[0] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
327 #
328 # # label 3 in GUI is input yy_file and needs a home directory
329 # $prefix[ $index[1] ] = '$DATA_SEISMIC_TXT' . ".'/'.";
330 #
331 # # label 9 in GUI is input zz_file and needs a home directory
332 # $prefix[ $index[2] ] = '$DATA_SEISMIC_SU' . ".'/'.";
333  
334 $supack2_spec->{_prefix_aref} = \@prefix;
335 return ();
336  
337 }
338  
339 =head2 sub suffix_aref
340  
341 Initialize suffixes as empty
342 values
343  
344 =cut
345  
346 sub suffix_aref {
347  
348 my $self = @_;
349  
350 my @suffix;
351  
352 for ( my $i = 0; $i < $max_index; $i++ ) {
353  
354 $suffix[$i] = $empty_string;
355  
356 }
357  
358 # my $index_aref = get_binding_index_aref();
359 # my @index = @$index_aref;
360 #
361 # # label 2 in GUI is input xx_file and needs a home directory
362 # $suffix[ $index[0] ] = ''.'' . '$suffix_bin';
363 #
364 # # label 3 in GUI is input yy_file and needs a home directory
365 # $suffix[ $index[1] ] = ''.'' . '$suffix_bin';
366 #
367 # # label 9 in GUI is output zz_file and needs a home directory
368 # $suffix[ $index[2] ] = ''.'' . '$suffix_su';
369  
370 $supack2_spec->{_suffix_aref} = \@suffix;
371 return ();
372  
373 }
374  
375 =head2 sub variables
376  
377  
378 return a hash array
379 with definitions
380
381 =cut
382  
383 sub variables {
384  
385 my ($self) = @_;
386 my $hash_ref = $supack2_spec;
387 return ($hash_ref);
388 }
389  
390 1;