-
Notifications
You must be signed in to change notification settings - Fork 404
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
Issue 7032: Implement Comparable on StreamCut & StreamCut.UNBOUNDED #7033
base: master
Are you sure you want to change the base?
Conversation
Signed-off-by: Derek Moore <derek.moore@dell.com>
Signed-off-by: Derek Moore <derek.moore@dell.com>
Signed-off-by: Derek Moore <derek.moore@dell.com>
Signed-off-by: Derek Moore <derek.moore@dell.com>
@@ -58,6 +58,11 @@ public String toString() { | |||
private Object readResolve() { | |||
return UNBOUNDED; | |||
} | |||
|
|||
@Override | |||
public int compareTo(StreamCut o) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is StreamCut.UNBOUNDED
's compareTo(). UNBOUNDED is used to mean both "possibly ever-truncating stream head" AND "ever-extending stream tail", depending on argument position (whether it is used as a start streamcut or an end streamcut). Given that UNBOUNDED can refer to the head OR the tail, depending on where it is used, how should its compareTo() behave?
Should it be equal only to itself and greater-than all other streamcuts? (That is, should it represent the unbounded tail when compared to?)
09f8270
to
ba631bc
Compare
Signed-off-by: “jose-robles2” <joserobles2230@gmail.com>
ba631bc
to
a606aa7
Compare
Signed-off-by: “jose-robles2” <joserobles2230@gmail.com>
Signed-off-by: “jose-robles2” <joserobles2230@gmail.com>
@derekm please, look this in case it is useful: #7032 (comment) |
Signed-off-by: Derek Moore <derek.moore@dell.com>
Signed-off-by: Derek Moore <derek.moore@dell.com>
Signed-off-by: Derek Moore <derek.moore@dell.com>
Signed-off-by: Derek Moore <derek.moore@dell.com>
Derek's changes look good to me. I've added some additional changes, so I am going wider with review. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #7033 +/- ##
=========================================
Coverage 86.35% 86.36%
- Complexity 16050 16068 +18
=========================================
Files 1031 1031
Lines 59815 59859 +44
Branches 6071 6086 +15
=========================================
+ Hits 51655 51697 +42
- Misses 4987 4989 +2
Partials 3173 3173
... and 16 files with indirect coverage changes Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report in Codecov by Sentry. |
Change log description
Adds
Comparable<StreamCut>
interface toStreamCut
. AddscompareTo()
methods toStreamCutImpl
andStreamCut.UNBOUNDED
.Purpose of the change
Fixes #7032
What the code does
It allows StreamCuts to be compared as naturally ordered things being less-than (<), greater-than (>), or equal-to (=). Overlapping StreamCuts are not comparable and produce a RuntimeException.
How to verify it
./gradlew :client:test --tests io.pravega.client.stream.StreamCutTest