lib/App/SeismicUnixGui/specs/data/ctrlstrip_spec.pm untested

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