lib/App/SeismicUnixGui/specs/shapeNcut/sugain_spec.pm untested

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