lib/App/SeismicUnixGui/specs/model/sukdsyn2d_spec.pm untested

filter: Statementstmt 0.0% 0 / 144 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 / 189 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::model::sukdsyn2d_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::model::sukdsyn2d';
9 my $get = L_SU_global_constants->new();
10 my $Project = Project_config->new();
11 my $sukdsyn2d = sukdsyn2d->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 = 32;
26  
27 my $sukdsyn2d_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 $index[0] = 20; # outbound item is bound
71 $index[1] = 31; # inbound item is bound
72 $sukdsyn2d_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 $sukdsyn2d_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 $sukdsyn2d_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 ( $sukdsyn2d_spec->{_binding_index_aref} ) {
129  
130 my $index_aref = $sukdsyn2d_spec->{_binding_index_aref};
131 return ($index_aref);
132  
133 } else {
134 print("sukdsyn2d_spec, get_binding_index_aref, missing binding_index_aref\n");
135 return ();
136 }
137  
138 my $index_aref = $sukdsyn2d_spec->{_binding_index_aref};
139 }
140  
141 =head2 sub get_binding_length
142  
143 =cut
144  
145 sub get_binding_length {
146  
147 my $self = @_;
148  
149 if ( $sukdsyn2d_spec->{_binding_index_aref} ) {
150  
151 my $binding_length = scalar @{ $sukdsyn2d_spec->{_binding_index_aref} };
152 return ($binding_length);
153  
154 } else {
155 print("sukdsyn2d_spec, get_binding_length, missing binding_length\n");
156 return ();
157 }
158  
159 return ();
160 }
161  
162 =head2 sub get_file_dialog_type_aref
163  
164 =cut
165  
166 sub get_file_dialog_type_aref {
167  
168 my $self = @_;
169 if ( $sukdsyn2d_spec->{_file_dialog_type_aref} ) {
170  
171 my $index_aref = $sukdsyn2d_spec->{_file_dialog_type_aref};
172 return ($index_aref);
173  
174 } else {
175 print("sukdsyn2d_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n");
176 return ();
177 }
178  
179 return ();
180 }
181  
182 =head2 sub get_flow_type_aref
183  
184 =cut
185  
186 sub get_flow_type_aref {
187  
188 my $self = @_;
189  
190 if ( $sukdsyn2d_spec->{_flow_type_aref} ) {
191  
192 my $index_aref = $sukdsyn2d_spec->{_flow_type_aref};
193 return ($index_aref);
194  
195 } else {
196 print("sukdsyn2d_spec, get_flow_type_aref, missing flow_type_aref\n");
197 return ();
198 }
199  
200 }
201  
202 =head2 sub get_incompatibles
203  
204 =cut
205  
206 sub get_incompatibles {
207  
208 my $self = @_;
209 my @needed;
210  
211 my @_need_both;
212  
213 my @_need_only_1;
214  
215 my @_none_needed;
216  
217 my @_all_needed;
218  
219 my $params = {
220  
221 _need_both => \@_need_both,
222 _need_only_1 => \@_need_only_1,
223 _none_needed => \@_none_needed,
224 _all_needed => \@_all_needed,
225  
226 };
227  
228 my @of_two = ( 'xx', 'yy' );
229 push @{ $params->{_need_only_1} }, \@of_two;
230  
231 my $len_1_needed = scalar @{ $params->{_need_only_1} };
232  
233 if ( $len_1_needed >= 1 ) {
234  
235 for ( my $i = 0; $i < $len_1_needed; $i++ ) {
236  
237 print("sukdsyn2d, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n");
238  
239 }
240  
241 } else {
242 print("get_incompatibles, no incompatibles\n");
243 }
244  
245 return ($params);
246  
247 }
248  
249 =head2 sub get_prefix_aref
250  
251 =cut
252  
253 sub get_prefix_aref {
254  
255 my $self = @_;
256  
257 if ( $sukdsyn2d_spec->{_prefix_aref} ) {
258  
259 my $prefix_aref = $sukdsyn2d_spec->{_prefix_aref};
260 return ($prefix_aref);
261  
262 } else {
263 print("sukdsyn2d_spec, get_prefix_aref, missing prefix_aref\n");
264 return ();
265 }
266  
267 return ();
268 }
269  
270 =head2 sub get_suffix_aref
271  
272 =cut
273  
274 sub get_suffix_aref {
275  
276 my $self = @_;
277  
278 if ( $sukdsyn2d_spec->{_suffix_aref} ) {
279  
280 my $suffix_aref = $sukdsyn2d_spec->{_suffix_aref};
281 return ($suffix_aref);
282  
283 } else {
284 print("$sukdsyn2d_spec, get_suffix_aref, missing suffix_aref\n");
285 return ();
286 }
287  
288 return ();
289 }
290  
291 =head2 sub prefix_aref
292  
293 Include in the Set up
294 sections of an output Poop flow.
295  
296 prefixes and suffixes to parameter labels
297 are filtered by sunix_pl
298  
299 =cut
300  
301 sub prefix_aref {
302  
303 my $self = @_;
304  
305 my @prefix;
306  
307 for ( my $i = 0; $i < $max_index; $i++ ) {
308  
309 $prefix[$i] = $empty_string;
310  
311 }
312  
313 my $index_aref = get_binding_index_aref();
314 my @index = @$index_aref;
315  
316 # label 21 in GUI is output xx_file and needs a home directory
317 $prefix[ $index[0] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
318  
319 # label 32 in GUI is input yy_file and needs a home directory
320 $prefix[ $index[1] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
321  
322 $sukdsyn2d_spec->{_prefix_aref} = \@prefix;
323 return ();
324  
325 }
326  
327 =head2 sub suffix_aref
328  
329 Initialize suffixes as empty
330 values
331  
332 =cut
333  
334 sub suffix_aref {
335  
336 my $self = @_;
337  
338 my @suffix;
339  
340 for ( my $i = 0; $i < $max_index; $i++ ) {
341  
342 $suffix[$i] = $empty_string;
343  
344 }
345  
346 my $index_aref = get_binding_index_aref();
347 my @index = @$index_aref;
348  
349 # label 2 in GUI is input xx_file and needs a home directory
350 $suffix[ $index[0] ] = '' . '' . '$suffix_bin';
351  
352 # label 3 in GUI is input yy_file and needs a home directory
353 $suffix[ $index[1] ] = '' . '' . '$suffix_bin';
354  
355 # label 9 in GUI is output zz_file and needs a home directory
356 $suffix[ $index[2] ] = '' . '' . '$suffix_su';
357  
358 $sukdsyn2d_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 = $sukdsyn2d_spec;
375 return ($hash_ref);
376 }
377  
378 1;