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

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