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

filter: Statementstmt 0.0% 0 / 143 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 / 188 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::elasyn_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::elasyn';
9 my $get = L_SU_global_constants->new();
10 my $Project = Project_config->new();
11 my $elasyn = elasyn->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 = 14;
26  
27 my $elasyn_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] = 11; # inbound item is bound
74 $index[1] = 13; # inbound item is bound
75  
76 $elasyn_spec->{_binding_index_aref} = \@index;
77 return ();
78  
79 }
80  
81 =head2 sub file_dialog_type_aref
82  
83 type of dialog (Data, Flow, SaveAs) is needed by binding
84 one type of dialog for each index
85 =cut
86  
87 sub file_dialog_type_aref {
88  
89 my $self = @_;
90  
91 my @type;
92  
93 my $index_aref = get_binding_index_aref();
94 my @index = @$index_aref;
95  
96 # bound index will look for data
97 $type[0] = '';
98 $type[ $index[0] ] = $file_dialog_type->{_Data};
99 $type[ $index[1] ] = $file_dialog_type->{_Data};
100  
101 $elasyn_spec->{_file_dialog_type_aref} = \@type;
102 return ();
103  
104 }
105  
106 =head2 sub flow_type_aref
107  
108 =cut
109  
110 sub flow_type_aref {
111  
112 my $self = @_;
113  
114 my @type;
115  
116 $type[0] = $flow_type->{_user_built};
117  
118 $elasyn_spec->{_flow_type_aref} = \@type;
119 return ();
120  
121 }
122  
123 =head2 sub get_binding_index_aref
124  
125 =cut
126  
127 sub get_binding_index_aref {
128  
129 my $self = @_;
130 my @index;
131  
132 if ( $elasyn_spec->{_binding_index_aref} ) {
133  
134 my $index_aref = $elasyn_spec->{_binding_index_aref};
135 return ($index_aref);
136  
137 } else {
138 print("elasyn_spec, get_binding_index_aref, missing binding_index_aref\n");
139 return ();
140 }
141  
142 my $index_aref = $elasyn_spec->{_binding_index_aref};
143 }
144  
145 =head2 sub get_binding_length
146  
147 =cut
148  
149 sub get_binding_length {
150  
151 my $self = @_;
152  
153 if ( $elasyn_spec->{_binding_index_aref} ) {
154  
155 my $binding_length = scalar @{ $elasyn_spec->{_binding_index_aref} };
156 return ($binding_length);
157  
158 } else {
159 print("elasyn_spec, get_binding_length, missing binding_length\n");
160 return ();
161 }
162  
163 return ();
164 }
165  
166 =head2 sub get_file_dialog_type_aref
167  
168 =cut
169  
170 sub get_file_dialog_type_aref {
171  
172 my $self = @_;
173 if ( $elasyn_spec->{_file_dialog_type_aref} ) {
174  
175 my $index_aref = $elasyn_spec->{_file_dialog_type_aref};
176 return ($index_aref);
177  
178 } else {
179 print("elasyn_spec, get_file_dialog_type_aref, missing get_file_dialog_type_aref\n");
180 return ();
181 }
182  
183 return ();
184 }
185  
186 =head2 sub get_flow_type_aref
187  
188 =cut
189  
190 sub get_flow_type_aref {
191  
192 my $self = @_;
193  
194 if ( $elasyn_spec->{_flow_type_aref} ) {
195  
196 my $index_aref = $elasyn_spec->{_flow_type_aref};
197 return ($index_aref);
198  
199 } else {
200 print("elasyn_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("elasyn, get_incompatibles,need_only_1: @{@{$params->{_need_only_1}}[$i]}\n");
242  
243 }
244  
245 } else {
246 print("get_incompatibles, no incompatibles\n");
247 }
248  
249 return ($params);
250  
251 }
252  
253 =head2 sub get_prefix_aref
254  
255 =cut
256  
257 sub get_prefix_aref {
258  
259 my $self = @_;
260  
261 if ( $elasyn_spec->{_prefix_aref} ) {
262  
263 my $prefix_aref = $elasyn_spec->{_prefix_aref};
264 return ($prefix_aref);
265  
266 } else {
267 print("elasyn_spec, get_prefix_aref, missing prefix_aref\n");
268 return ();
269 }
270  
271 return ();
272 }
273  
274 =head2 sub get_suffix_aref
275  
276 =cut
277  
278 sub get_suffix_aref {
279  
280 my $self = @_;
281  
282 if ( $elasyn_spec->{_suffix_aref} ) {
283  
284 my $suffix_aref = $elasyn_spec->{_suffix_aref};
285 return ($suffix_aref);
286  
287 } else {
288 print("$elasyn_spec, get_suffix_aref, missing suffix_aref\n");
289 return ();
290 }
291  
292 return ();
293 }
294  
295 =head2 sub prefix_aref
296  
297 Include in the Set up
298 sections of an output Poop flow.
299  
300 prefixes and suffixes to parameter labels
301 are filtered by sunix_pl
302  
303 =cut
304  
305 sub prefix_aref {
306  
307 my $self = @_;
308  
309 my @prefix;
310  
311 for ( my $i = 0; $i < $max_index; $i++ ) {
312  
313 $prefix[$i] = $empty_string;
314  
315 }
316  
317 my $index_aref = get_binding_index_aref();
318 my @index = @$index_aref;
319  
320 # label 12 in GUI is output xx_file and needs a home directory
321 $prefix[ $index[0] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
322  
323 # label 14 in GUI is output yy_file and needs a home directory
324 $prefix[ $index[1] ] = '$DATA_SEISMIC_BIN' . ".'/'.";
325  
326 $elasyn_spec->{_prefix_aref} = \@prefix;
327 return ();
328  
329 }
330  
331 =head2 sub suffix_aref
332  
333 Initialize suffixes as empty
334 values
335  
336 =cut
337  
338 sub suffix_aref {
339  
340 my $self = @_;
341  
342 my @suffix;
343  
344 for ( my $i = 0; $i < $max_index; $i++ ) {
345  
346 $suffix[$i] = $empty_string;
347  
348 }
349  
350 my $index_aref = get_binding_index_aref();
351 my @index = @$index_aref;
352  
353 # label 12 in GUI is output xx_file and needs a home directory
354 $suffix[ $index[0] ] = '' . '' . '$suffix_bin';
355  
356 # label 14 in GUI is output yy_file and needs a home directory
357 $suffix[ $index[1] ] = '' . '' . '$suffix_bin';
358  
359 $elasyn_spec->{_suffix_aref} = \@suffix;
360 return ();
361  
362 }
363  
364 =head2 sub variables
365  
366  
367 return a hash array
368 with definitions
369
370 =cut
371  
372 sub variables {
373  
374 my ($self) = @_;
375 my $hash_ref = $elasyn_spec;
376 return ($hash_ref);
377 }
378  
379 1;