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