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

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