lib/App/SeismicUnixGui/specs/model/elacheck_spec.pm untested

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