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