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

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