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

filter: Statementstmt 0.0% 0 / 124 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 16 Podpod 0.0% 0 / 13 totaltotal 0.0% 0 / 167 CC 8 SCAR 14.9
CC
8
Cov
0%
get_binding_index_aref
6.0
get_binding_length
6.0
get_file_dialog_type_aref
6.0
CRAP 4.4
1 package App::SeismicUnixGui::specs::data::wtcomp_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  
8 my $get = L_SU_global_constants->new();
9 my $Project = Project_config->new();
10  
11 my $var = $get->var();
12  
13 my $empty_string = $var->{_empty_string};
14 my $true = $var->{_true};
15 my $false = $var->{_false};
16 my $file_dialog_type = $get->file_dialog_type_href();
17 my $flow_type = $get->flow_type_href();
18  
19 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
20 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); # output data directory
21 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT(); # output data directory
22 my $PL_SEISMIC = $Project->PL_SEISMIC();
23 my $max_index = 5;
24  
25 my $wtcomp_spec = {
26 _CONFIG => $PL_SEISMIC,
27 _DATA_DIR_IN => $DATA_SEISMIC_BIN,
28 _DATA_DIR_OUT => $DATA_SEISMIC_SU,
29 _binding_index_aref => '',
30 _suffix_type_in => $su,
31 _data_suffix_in => $suffix_su,
32 _suffix_type_out => $su,
33 _data_suffix_out => $suffix_su,
34 _file_dialog_type_aref => '',
35 _flow_type_aref => '',
36 _has_infile => $true,
37 _has_outpar => $false,
38 _has_pipe_in => $true,
39 _has_pipe_out => $true,
40 _has_redirect_in => $true,
41 _has_redirect_out => $true,
42 _has_subin_in => $false,
43 _has_subin_out => $false,
44 _is_data => $false,
45 _is_first_of_2 => $true,
46 _is_first_of_3or_more => $true,
47 _is_first_of_4or_more => $true,
48 _is_last_of_2 => $false,
49 _is_last_of_3or_more => $false,
50 _is_last_of_4or_more => $false,
51 _is_suprog => $true,
52 _is_superflow => $false,
53 _max_index => $max_index,
54 _prefix_aref => '',
55 _suffix_aref => '',
56 };
57  
58 =head2 sub binding_index_aref
59  
60 =cut
61  
62 sub binding_index_aref {
63  
64 my $self = @_;
65  
66 my @index;
67  
68 # first binding index (index=0)
69 # connects to second item (index=1)
70 # in the parameter list
71 # $index[0] = 1; # inbound item is bound
72 # $index[1] = 2; # inbound item is bound
73 # $index[2] = 8; # outbound item is bound
74  
75 $wtcomp_spec->{_binding_index_aref} = \@index;
76 return ();
77  
78 }
79  
80 =head2 sub file_dialog_type_aref
81  
82 type of dialog (Data, Flow, SaveAs) is needed by binding
83 one type of dialog for each index
84 =cut
85  
86 sub file_dialog_type_aref {
87  
88 my $self = @_;
89  
90 my @type;
91  
92 my $index_aref = get_binding_index_aref();
93 my @index = @$index_aref;
94  
95 # bound index will look for data
96 $type[0] = '';
97  
98 # $type[$index[0]] = $file_dialog_type->{_Data};
99 # $type[$index[1]] = $file_dialog_type->{_Data};
100 # $type[$index[2]] = $file_dialog_type->{_Data};
101  
102 $wtcomp_spec ->{_file_dialog_type_aref} = \@type;
103  
104 return ();
105  
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 $wtcomp_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 ( $wtcomp_spec->{_binding_index_aref} ) {
135  
136 my $index_aref = $wtcomp_spec->{_binding_index_aref};
137 return ($index_aref);
138  
139 } else {
140 print("wtcomp_spec, get_binding_index_aref, missing binding_index_aref\n");
141 return ();
142 }
143  
144 my $index_aref = $wtcomp_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 ( $wtcomp_spec->{_binding_index_aref} ) {
156  
157 my $binding_length = scalar @{ $wtcomp_spec->{_binding_index_aref} };
158 return ($binding_length);
159  
160 } else {
161 print("wtcomp_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 ( $wtcomp_spec->{_file_dialog_type_aref} ) {
176  
177 my $index_aref = $wtcomp_spec->{_file_dialog_type_aref};
178 return ($index_aref);
179  
180 } else {
181 print("wtcomp_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 ( $wtcomp_spec->{_flow_type_aref} ) {
197  
198 my $index_aref = $wtcomp_spec->{_flow_type_aref};
199 return ($index_aref);
200  
201 } else {
202 print("wtcomp_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("wtcomp, 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 ( $wtcomp_spec->{_prefix_aref} ) {
264  
265 my $prefix_aref = $wtcomp_spec->{_prefix_aref};
266 return ($prefix_aref);
267  
268 } else {
269 print("wtcomp_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 ( $wtcomp_spec->{_suffix_aref} ) {
285  
286 my $suffix_aref = $wtcomp_spec->{_suffix_aref};
287 return ($suffix_aref);
288  
289 } else {
290 print("$wtcomp_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 $wtcomp_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 $wtcomp_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 = $wtcomp_spec;
384 return ($hash_ref);
385 }
386  
387 1;