lib/App/SeismicUnixGui/specs/shell/suputgthr_spec.pm untested

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