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

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