Skip to content
This repository has been archived by the owner on Sep 15, 2021. It is now read-only.

Clean up imports and whitespace. #88

Merged
merged 2 commits into from
Apr 27, 2016
Merged

Conversation

deflaux
Copy link
Contributor

@deflaux deflaux commented Apr 27, 2016

This is in preparation for v1beta2 -> v1 code changes.

@@ -99,7 +99,7 @@ public Contig apply(String contigString) {
// the ShardUtils methods should be used to ensure that shards are shuffled all together before
// being returned to clients.
List<Contig> getShards(long numberOfBasesPerShard) {
double shardCount = Math.ceil(end - start) / numberOfBasesPerShard;
double shardCount = (end - start) / (double) numberOfBasesPerShard;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just keep them as long - the double has no effect, as the decimal portion and will not have impact in the for loop. Any decimal portion in a long will be just Math.floor automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Math.floor isn't what we want here. See also the unit tests.

The useless Math.ceil there before caused a double cast on the numerator, which is why the old version "worked".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Nicole, but I am not contributing code, and not sure why my post just disappeared though. This is a friendly discussion of exploratory ideas, and the code I posted was mostly your code with a proof-of-concept of why Math.ceil might not be useless. This is just Java-logic that commonly discussed everywhere among all programmers.

@calbach
Copy link
Contributor

calbach commented Apr 27, 2016

LGTM - that's a lot of whitespace.

@deflaux deflaux merged commit 829e4ec into googlegenomics:master Apr 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants