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

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