Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#802 created iterator of floats and ints #832

Merged
merged 2 commits into from
May 8, 2018
Merged

Conversation

krzyk
Copy link
Contributor

@krzyk krzyk commented May 7, 2018

#802

  • created IteratorOfFloats and IteratorOfInts and updated the appropriate Iterables
  • added tests for those new classes
  • added todo to continue implementation of longs and shorts

@0crat 0crat added the scope label May 7, 2018
@0crat
Copy link
Collaborator

0crat commented May 7, 2018

Job #832 is now in scope, role is REV

@0crat
Copy link
Collaborator

0crat commented May 7, 2018

This pull request #832 is assigned to @proshin-roman/z, here is why; the budget is 15 minutes, see §4; please, read §27 and when you decide to accept the changes, inform @llorllale/z (the architect) right in this ticket; if you decide that this PR should not be accepted ever, also inform the architect; this blog post will help you understand what is expected from a code reviewer

Copy link
Contributor

@proshin-roman proshin-roman left a comment

Choose a reason for hiding this comment

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

@krzyk I found a few issues - please, check if they should/can be fixed.

/**
* The list of items to iterate.
*/
private final float[] list;
Copy link
Contributor

Choose a reason for hiding this comment

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

@krzyk As this field is not a list anyway, wouldn't it better to rename it to items?

/**
* The list of items to iterate.
*/
private final int[] list;
Copy link
Contributor

Choose a reason for hiding this comment

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

@krzyk same here: rename it to items?

@Test
public void emptyIteratorDoesNotHaveNext() {
MatcherAssert.assertThat(
"Can't create empty iterator",
Copy link
Contributor

Choose a reason for hiding this comment

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

@krzyk The failure message looks strange - failing of the assertions means that empty iterator has the next item which is wrong. Could you adjust the message, please?

MatcherAssert.assertThat(
"Can't create empty iterator",
new IteratorOfFloats().hasNext(),
CoreMatchers.equalTo(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

@krzyk let's please use new IsEqual(true) instead of calling a static method?

@Test
public void nonEmptyIteratorDoesNotHaveNext() {
MatcherAssert.assertThat(
"Can't create non empty iterator",
Copy link
Contributor

Choose a reason for hiding this comment

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

@krzyk here again: the failure message is not correct - it should explain the cause of assertion failing: an iterator with fetched items still has the next item which is wrong. Please, fix the message.

MatcherAssert.assertThat(
"Can't create non empty iterator",
this.iteratorWithFetchedElements().hasNext(),
CoreMatchers.equalTo(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

@krzyk And here too: please, use IsEqual

* @since 0.32
* @checkstyle JavadocMethodCheck (500 lines)
*/
public final class IteratorOfIntsTest {
Copy link
Contributor

Choose a reason for hiding this comment

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

@krzyk all comments written for IteratorOfFloatsTest can be applied for this class as well.

return iterable;
});
super(() -> ()
-> new UncheckedScalar<>(() -> new IteratorOfInts(values)).value()
Copy link
Contributor

Choose a reason for hiding this comment

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

@krzyk I might be wrong here (please, correct me if it's so), but using of UncheckedScalar looks redundant here, as the super ctor already wraps the argument into UncheckedScalar:

this.iterable = new UncheckedScalar<>(scalar);

Could you check please if that's correct and UncheckedScalar can be ommitted here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@proshin-roman unchecked scalar is for Iterator interface (there are 3 lambdas here) so I need to wrap it at the bottom, wrapping in IterableEnvelope doesn't help here

Copy link
Collaborator

Choose a reason for hiding this comment

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

@krzyk why didn't you just write () -> () -> new IteratorOfInts(values)? I don't get what you wrote provides. The constructor of IteratorOfInts does not throw any exception...

Copy link
Collaborator

Choose a reason for hiding this comment

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

@krzyk or () -> new IterableOf<>(new IteratorOfInts(values)) if you prefer

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@victornoel I didn't know I could (regarding the first of your comments - it wasn't possible, I didn't tried the second one)

Copy link
Collaborator

Choose a reason for hiding this comment

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

@krzyk ok thanks, I will take that into account for solving #838 :)

@codecov-io
Copy link

codecov-io commented May 8, 2018

Codecov Report

Merging #832 into master will increase coverage by 0.04%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #832      +/-   ##
============================================
+ Coverage     84.51%   84.56%   +0.04%     
- Complexity     1368     1376       +8     
============================================
  Files           249      251       +2     
  Lines          3695     3705      +10     
  Branches        215      213       -2     
============================================
+ Hits           3123     3133      +10     
  Misses          524      524              
  Partials         48       48
Impacted Files Coverage Δ Complexity Δ
...ain/java/org/cactoos/iterable/IterableOfLongs.java 100% <ø> (ø) 3 <0> (ø) ⬇️
...in/java/org/cactoos/iterator/IteratorOfFloats.java 100% <100%> (ø) 5 <5> (?)
...main/java/org/cactoos/iterator/IteratorOfInts.java 100% <100%> (ø) 5 <5> (?)
...in/java/org/cactoos/iterable/IterableOfFloats.java 100% <100%> (ø) 2 <2> (-1) ⬇️
...main/java/org/cactoos/iterable/IterableOfInts.java 100% <100%> (ø) 2 <2> (-1) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4738a00...9346b81. Read the comment docs.

@krzyk
Copy link
Contributor Author

krzyk commented May 8, 2018

@proshin-roman I've updated the code, please take a look

Copy link
Contributor

@proshin-roman proshin-roman left a comment

Choose a reason for hiding this comment

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

@llorllale good to merge

@llorllale
Copy link
Contributor

@rultor merge

@rultor
Copy link
Collaborator

rultor commented May 8, 2018

@rultor merge

@llorllale OK, I'll try to merge now. You can check the progress of the merge here

@rultor rultor merged commit 9346b81 into yegor256:master May 8, 2018
@rultor
Copy link
Collaborator

rultor commented May 8, 2018

@rultor merge

@llorllale Done! FYI, the full log is here (took me 10min)

@0crat
Copy link
Collaborator

0crat commented May 8, 2018

@elenavolokhova/z please review this job completed by @proshin-roman/z, as in §30; the job will be fully closed and all payments will be made when the quality review is completed

@0crat 0crat removed the scope label May 8, 2018
@0crat
Copy link
Collaborator

0crat commented May 8, 2018

The job #832 is now out of scope

@elenavolokhova
Copy link

@0crat quality good

@0crat
Copy link
Collaborator

0crat commented May 8, 2018

Order was finished, quality is "good": +20 point(s) just awarded to @proshin-roman/z

@0crat
Copy link
Collaborator

0crat commented May 8, 2018

Quality review completed: +8 point(s) just awarded to @elenavolokhova/z

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.

9 participants