lib/App/SeismicUnixGui/specs/par/unisam_spec.pm untested

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