Skip to content

Conversation

FridaTveit
Copy link
Contributor

Extracted Peak from Graph and extracted PeakComparer from PlateVerticalGraph. Added unit tests for PeakComparer (renamed to PeakComparator).

Copy link
Owner

@oskopek oskopek left a comment

Choose a reason for hiding this comment

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

Thanks for the PR :) I'll merge as soon as you fix the comments I left.

public class PeakComparator implements Comparator<Peak> {
private PlateVerticalGraph graphHandle = null;

public PeakComparator(PlateVerticalGraph graph) {
Copy link
Owner

Choose a reason for hiding this comment

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

Let's only pass yValues into this comparator. It will be easier to test and more encapsulated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, will change it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done :)


@Before
public void setup() {
PlateVerticalGraph plateVerticalGraph = mock(PlateVerticalGraph.class);
Copy link
Owner

Choose a reason for hiding this comment

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

You don't need this mock after you change the parameters in the comparator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, will change it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done :)


@Override
public int compare(Peak peak1, Peak peak2) {
return Double.compare(getPeakValue(peak1), getPeakValue(peak2));
Copy link
Owner

Choose a reason for hiding this comment

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

There's a bug on this line - you reversed the order of peak1 and peak2 in the comparison. That's why the tests are failing. Also, fix your added test after you switch these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, will change it!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done :)

…it to PeakComparator and simplified compare method. Extracting PeakComparer also required extracting Peak from Graph. Changed Plate, CatSnapShot, Band and BandGraph to reflect this. Removed unused field handle from PlateVerticalGraph.
…t that). Made PeakComparator take a vector of floats instead of a PlateVerticalGraph in its constructor.
@FridaTveit FridaTveit force-pushed the ExtractNestedClassFromPlateVerticalGraph branch from 82b491d to 8738dcd Compare December 23, 2016 15:06
@coveralls
Copy link

coveralls commented Dec 23, 2016

Coverage Status

Coverage increased (+0.4%) to 14.52% when pulling 8738dcd on FridaTveit:ExtractNestedClassFromPlateVerticalGraph into 45b7c34 on oskopek:master.

@coveralls
Copy link

coveralls commented Dec 23, 2016

Coverage Status

Coverage increased (+0.4%) to 14.52% when pulling 8738dcd on FridaTveit:ExtractNestedClassFromPlateVerticalGraph into 45b7c34 on oskopek:master.

@coveralls
Copy link

coveralls commented Dec 23, 2016

Coverage Status

Coverage increased (+0.4%) to 14.463% when pulling d8e3efe on FridaTveit:ExtractNestedClassFromPlateVerticalGraph into 6f1735d on oskopek:master.

@oskopek oskopek merged commit 4455058 into oskopek:master Dec 23, 2016
@oskopek
Copy link
Owner

oskopek commented Dec 23, 2016

Thanks for all the PRs @FridaTveit :) Merry Christmas 🎄

@FridaTveit
Copy link
Contributor Author

Merry Christmas! :) 🎄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants