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