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

filter: Statementstmt 0.0% 0 / 134 Branchbran 0.0% 0 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 19 Podpod 0.0% 0 / 14 totaltotal 0.0% 0 / 183 CC 9 SCAR 14.7
CC
9
Cov
0%
get_binding_index_aref
6.0
get_max_index
6.0
get_file_dialog_type_aref
6.0
CRAP 4.4
1 package App::SeismicUnixGui::specs::data::data_in_spec;
2  
3 =head1 DOCUMENTATION
4  
5 =head2 SYNOPSIS
6  
7 PERL PROGRAM NAME: data_in_spec.pm
8 AUTHOR: Juan Lorenzo
9 DATE: June 22 2017
10
11  
12 DESCRIPTION
13
14  
15 BASED ON:
16 Version 0.0.1 June 22 2017
17  
18 Version 0.0.2 July 22 2018
19  
20  
21 =cut# output data directory
22  
23 =head2 USE
24  
25 =head3 NOTES
26  
27 =head4 Examples
28  
29  
30 =head2 CHANGES and their DATES
31 Version 0.0.2 July 22 2018 added subs:
32 type, inbound _get_inbound
33 _get_suffix, _get_DIR
34  
35 =cut
36  
37 use Moose;
38 our $VERSION = '0.0.2';
39  
40 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
41 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
42 use aliased 'App::SeismicUnixGui::sunix::data::data_in';
43 use App::SeismicUnixGui::misc::SeismicUnix qw($su $suffix_su);
44  
45 my $get = L_SU_global_constants->new();
46 my $var = $get->var();
47 my $file_dialog_type = $get->file_dialog_type_href();
48 my $flow_type = $get->flow_type_href();
49  
50 my $empty_string = $var->{_empty_string};
51 my $true = $var->{_true};
52 my $false = $var->{_false};
53 my $Project = Project_config->new();
54  
55 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU(); # output data directory
56 my $PL_SEISMIC = $Project->PL_SEISMIC();
57  
58 my $data_in = data_in->new();
59 my $max_index = $data_in->get_max_index();
60  
61 my $data_in_spec = {
62 _CONFIG => $PL_SEISMIC,
63 _DATA_DIR_IN => $DATA_SEISMIC_SU,
64 _DATA_DIR_OUT => $DATA_SEISMIC_SU,
65 _binding_index_aref => '',
66 _suffix_type_in => $su,
67 _data_suffix_in => $suffix_su,
68 _suffix_type_out => $su,
69 _data_suffix_out => $suffix_su,
70 _file_dialog_type_aref => '',
71 _flow_type_aref => '',
72 _has_infile => $false,
73 _has_pipe_in => $false,
74 _has_pipe_out => $true,
75 _has_redirect_in => $false,
76 _has_redirect_out => $false,
77 _has_subin_in => $false,
78 _has_subin_out => $false,
79 _is_data => $true,
80 _is_first_of_2 => $false,
81 _is_first_of_3or_more => $false,
82 _is_first_of_4or_more => $false,
83 _is_last_of_2 => $true,
84 _is_last_of_3or_more => $false,
85 _is_last_of_4or_more => $false,
86 _is_suprog => $true, # JML 8/28/19
87 _is_superflow => $false,
88 _max_index => $max_index,
89 };
90  
91 =head2 sub binding_index_aref
92  
93 help bind a parameter (in calling module)
94 to a callback via a mouse-click
95  
96 =cut
97  
98 sub binding_index_aref {
99 my ($self) = @_;
100 my @index;
101  
102 $index[0] = 0; # first item is bound to DATA_SEISMIC_SU
103  
104 $data_in_spec->{_binding_index_aref} = \@index;
105  
106 return ();
107 }
108  
109 =head2 sub get_binding_index_aref
110  
111 =cut
112  
113 sub get_binding_index_aref {
114 my ($self) = @_;
115 my @index;
116  
117 if ( $data_in_spec->{_binding_index_aref} ) {
118 my $index_aref = $data_in_spec->{_binding_index_aref};
119 return ($index_aref);
120  
121 }
122 else {
123 print(
124 "data_in_spec, get_binding_index_aref, missing binding_index_aref\n"
125 );
126 return ();
127 }
128  
129 my $index_aref = $data_in_spec->{_binding_index_aref};
130  
131 }
132  
133 =head2 sub get_max_index
134  
135 =cut
136  
137 sub get_max_index {
138 my ($self) = @_;
139  
140 if ( $data_in_spec->{_max_index} ) {
141  
142 my $max_idx = $data_in->get_max_index();
143 return ($max_idx);
144  
145 }
146 else {
147 print("data_in_spec, get_max_index, missing max_index\n");
148 return ();
149 }
150 }
151  
152 =head2 sub file_dialog_type_aref
153  
154 =cut
155  
156 sub file_dialog_type_aref {
157 my ($self) = @_;
158  
159 my @type;
160  
161 $type[0] = $file_dialog_type->{_Data};
162  
163 $data_in_spec->{_file_dialog_type_aref} = \@type;
164  
165 return ();
166  
167 }
168  
169 =head2 sub get_file_dialog_type_aref
170  
171 =cut
172  
173 sub get_file_dialog_type_aref {
174 my ($self) = @_;
175  
176 if ( $data_in_spec->{_file_dialog_type_aref} ) {
177 my @type = @{ $data_in_spec->{_file_dialog_type_aref} };
178 return ( \@type );
179 }
180 else {
181 print(
182 "data_in_spec,get_file_dialog_type_aref, missing file_dialog_type_aref\n"
183 );
184 return ();
185 }
186 }
187  
188 =head2 sub flow_type_aref
189  
190 =cut
191  
192 sub flow_type_aref {
193 my ($self) = @_;
194  
195 my @type;
196  
197 $type[0] = $flow_type->{_user_built};
198  
199 $data_in_spec->{_flow_type_aref} = \@type;
200  
201 return ();
202  
203 }
204  
205 =head2 sub get_binding_length
206  
207 =cut
208  
209 sub get_binding_length {
210 my ($self) = @_;
211  
212 if ( $data_in_spec->{_binding_index_aref} ) {
213 my $length;
214 $length = scalar @{ $data_in_spec->{_binding_index_aref} };
215 return ($length);
216  
217 }
218 else {
219  
220 print("data_in_spec, get_binding_length, missing length \n");
221 return ();
222 }
223  
224 }
225  
226 =head2 sub get_flow_type_aref
227  
228 =cut
229  
230 sub get_flow_type_aref {
231 my ($self) = @_;
232  
233 if ( $data_in_spec->{_flow_type_aref} ) {
234 my $type_aref = $data_in_spec->{_flow_type_aref};
235 return ($type_aref);
236 }
237 else {
238  
239 print("data_in_spec, get_flow_type_aref, missing flow_type_aref \n");
240 return ();
241 }
242 }
243  
244 =head2 sub get_incompatibles
245  
246 =cut
247  
248 sub get_incompatibles {
249  
250 my ($self) = @_;
251 my @needed;
252  
253 my @_need_both;
254  
255 my @_need_only_1;
256  
257 my @_none_needed;
258  
259 my @_all_needed;
260  
261 my $params = {
262  
263 _need_both => \@_need_both,
264 _need_only_1 => \@_need_only_1,
265 _none_needed => \@_none_needed,
266 _all_needed => \@_all_needed,
267  
268 };
269  
270 my @of_two = ( 'xx', 'yy' );
271 push @{ $params->{_need_only_1} }, \@of_two;
272  
273 my $len_1_needed = scalar @{ $params->{_need_only_1} };
274  
275 if ( $len_1_needed >= 1 ) {
276  
277 for ( my $i = 0 ; $i < $len_1_needed ; $i++ ) {
278  
279 print(
280 "data_in, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n"
281 );
282  
283 }
284  
285 }
286 else {
287 print("get_incompatibles, no incompatibles\n");
288 }
289  
290 return ($params);
291  
292 }
293  
294 =head2 sub get_prefix_aref
295  
296 =cut
297  
298 sub get_prefix_aref {
299  
300 my ($self) = @_;
301  
302 if ( $data_in_spec->{_prefix_aref} ) {
303  
304 my $prefix_aref = $data_in_spec->{_prefix_aref};
305 return ($prefix_aref);
306  
307 }
308 else {
309 print("data_in_spec, get_prefix_aref, missing prefix_aref\n");
310 return ();
311 }
312  
313 return ();
314 }
315  
316 =head2 sub get_suffix_aref
317  
318 =cut
319  
320 sub get_suffix_aref {
321  
322 my ($self) = @_;
323  
324 if ( $data_in_spec->{_suffix_aref} ) {
325  
326 my $suffix_aref = $data_in_spec->{_suffix_aref};
327 return ($suffix_aref);
328  
329 }
330 else {
331 print("data_in_spec, get_suffix_aref, missing suffix_aref\n");
332 return ();
333 }
334  
335 return ();
336 }
337  
338 =head2 sub prefix_aref
339  
340 Include in the Set up
341 sections of an output Poop flow.
342  
343 prefixes and suffixes to parameter labels
344 are filtered by sunix_pl
345  
346 =cut
347  
348 sub prefix_aref {
349  
350 my ($self) = @_;
351  
352 my @prefix;
353  
354 for ( my $i = 0 ; $i < $max_index ; $i++ ) {
355  
356 $prefix[$i] = $empty_string;
357  
358 }
359 $data_in_spec->{_prefix_aref} = \@prefix;
360 return ();
361  
362 }
363  
364 =head2 sub suffix_aref
365  
366 Initialize suffixes as empty
367 Assign specific suffixes to parameter
368 values
369  
370 =cut
371  
372 sub suffix_aref {
373  
374 my ($self) = @_;
375  
376 my @suffix;
377  
378 for ( my $i = 0 ; $i < $max_index ; $i++ ) {
379  
380 $suffix[$i] = $empty_string;
381  
382 }
383 $data_in_spec->{_suffix_aref} = \@suffix;
384 return ();
385  
386 }
387  
388 =head2 sub variables
389  
390 return a hash array
391 with definitions
392  
393 =cut
394  
395 sub variables {
396 my $self = @_;
397 my $hash_ref = $data_in_spec;
398 return ($hash_ref);
399 }
400  
401 1;