lib/App/SeismicUnixGui/specs/transform/suamp_spec.pm untested

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