lib/App/SeismicUnixGui/specs/plot/supswigb_spec.pm untested

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