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