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