Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ensembl-gh-mirror
ensembl-hive
Commits
39a9b86b
Commit
39a9b86b
authored
Nov 23, 2015
by
Matthieu Muffato
Browse files
Made _add_together() a method so that we can die if input data are missing
parent
db9be104
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
modules/Bio/EnsEMBL/Hive/RunnableDB/LongMult/AddTogether.pm
modules/Bio/EnsEMBL/Hive/RunnableDB/LongMult/AddTogether.pm
+8
-3
No files found.
modules/Bio/EnsEMBL/Hive/RunnableDB/LongMult/AddTogether.pm
View file @
39a9b86b
...
...
@@ -93,7 +93,7 @@ sub run { # call the function that will compute the stuff
my
$b_multiplier
=
$self
->
param_required
('
b_multiplier
');
my
$partial_product
=
$self
->
param
('
partial_product
');
$self
->
param
('
result
',
_add_together
(
$b_multiplier
,
$partial_product
));
$self
->
param
('
result
',
$self
->
_add_together
(
$b_multiplier
,
$partial_product
));
sleep
(
$self
->
param
('
take_time
')
);
}
...
...
@@ -114,20 +114,25 @@ sub write_output { # store and dataflow
},
1
);
}
=head2 _add_together
Description: this is a private
function (not a
method
)
that adds all the products with a shift
Description: this is a private method that adds all the products with a shift
=cut
sub
_add_together
{
my
(
$b_multiplier
,
$partial_product
)
=
@_
;
my
(
$self
,
$b_multiplier
,
$partial_product
)
=
@_
;
my
@accu
=
();
my
@b_digits
=
reverse
split
(
//
,
$b_multiplier
);
foreach
my
$b_index
(
0
..
(
@b_digits
-
1
))
{
my
$b_digit
=
$b_digits
[
$b_index
];
if
(
not
exists
$partial_product
->
{
$b_digit
})
{
$self
->
input_job
->
transient_error
(
0
);
die
"
Could not find the partial product for the digit '
$b_digit
'
\n
";
}
my
$product
=
$partial_product
->
{
$b_digit
};
my
@p_digits
=
reverse
split
(
//
,
$product
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment