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

filter: Statementstmt 0.0% 0 / 131 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 / 176 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::plot::pslabel_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 $ps $su $suffix_bin $suffix_ps $suffix_su $suffix_txt $txt);
7 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
8 use aliased 'App::SeismicUnixGui::sunix::plot::pslabel';
9 my $get = L_SU_global_constants->new();
10 my $Project = Project_config->new();
11 my $pslabel = pslabel->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 $PS_SEISMIC = $Project->PS_SEISMIC(); # 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 = 6;
26  
27 my $pslabel_spec = {
28 _CONFIG => $PL_SEISMIC,
29 _DATA_DIR_IN => $DATA_SEISMIC_BIN,
30 _DATA_DIR_OUT => $PS_SEISMIC,
31 _binding_index_aref => '',
32 _suffix_type_in => $bin,
33 _data_suffix_in => $suffix_bin,
34 _suffix_type_out => $ps,
35 _data_suffix_out => $suffix_ps,
36 _file_dialog_type_aref => '',
37 _flow_type_aref => '',
38 _has_infile => $false,
39 _has_outpar => $false,
40 _has_pipe_in => $false,
41 _has_pipe_out => $false,
42 _has_redirect_in => $false,
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 => $false,
49 _is_first_of_4or_more => $false,
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 $pslabel_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  
100 # $type[$index[0]] = $file_dialog_type->{_Data};
101 # $type[$index[1]] = $file_dialog_type->{_Data};
102 # $type[$index[2]] = $file_dialog_type->{_Data};
103  
104 $pslabel_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 $pslabel_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 ( $pslabel_spec->{_binding_index_aref} ) {
136  
137 my $index_aref = $pslabel_spec->{_binding_index_aref};
138 return ($index_aref);
139  
140 }
141 else {
142 print(
143 "pslabel_spec, get_binding_index_aref, missing binding_index_aref\n"
144 );
145 return ();
146 }
147  
148 my $index_aref = $pslabel_spec->{_binding_index_aref};
149 }
150  
151 =head2 sub get_binding_length
152  
153 =cut
154  
155 sub get_binding_length {
156  
157 my $self = @_;
158  
159 if ( $pslabel_spec->{_binding_index_aref} ) {
160  
161 my $binding_length = scalar @{ $pslabel_spec->{_binding_index_aref} };
162 return ($binding_length);
163  
164 }
165 else {
166 print("pslabel_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 ( $pslabel_spec->{_file_dialog_type_aref} ) {
181  
182 my $index_aref = $pslabel_spec->{_file_dialog_type_aref};
183 return ($index_aref);
184  
185 }
186 else {
187 print(
188 "pslabel_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 ( $pslabel_spec->{_flow_type_aref} ) {
205  
206 my $index_aref = $pslabel_spec->{_flow_type_aref};
207 return ($index_aref);
208  
209 }
210 else {
211 print("pslabel_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 "pslabel, 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 ( $pslabel_spec->{_prefix_aref} ) {
276  
277 my $prefix_aref = $pslabel_spec->{_prefix_aref};
278 return ($prefix_aref);
279  
280 }
281 else {
282 print("pslabel_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 ( $pslabel_spec->{_suffix_aref} ) {
298  
299 my $suffix_aref = $pslabel_spec->{_suffix_aref};
300 return ($suffix_aref);
301  
302 }
303 else {
304 print("$pslabel_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 $pslabel_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 $pslabel_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 = $pslabel_spec;
398 return ($hash_ref);
399 }
400  
401 1;