lib/App/SeismicUnixGui/specs/shapeNcut/susplit_spec.pm untested

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