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