-
Notifications
You must be signed in to change notification settings - Fork 36
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
adaptations for RangeDimension indexOf methods #819
Conversation
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.
I like it. It gets a little intense with the number of options, but I think the defaults are good so most users wont have to worry about it. The one default I would change is the inclusive/exclusive range matching. I would have preferred exclusive to be the default, though I get why it makes more sense to keep it inclusive since it was the previous default behaviour.
I like the default strict mode when searching for multiple indexes/ranges.
I don't think it's a good idea to silently swap start and end when end < start
though (noted below).
along with respective tests
this overload uses the PositionMatch enum. Added tests for it.
adapt the method implementation to use new getIndex function
which now takes takes (optionally) the ticks, and the RangeMatch arg to control inclusive or exclusive range matching
to use the optional variants of indexOf, invalid ranges are "silently" ignored
…im ... This is to define whether invalid start - end ranges are silently ignored or in an exception should be thrown
to control whether invalid ranges lead to an exception,
positions less than offset now directly lead to an OutOfBounds error, add an overload to simplify function calls, adapt the tests accordingly
plus respective tests
overloads for optionals that support range and position matching, respective tests
This pull request is the first step for fixing the issue raised in #818
Adds some overloads to the RangeDimension::indexOf method family that allow for some behavior controlling. Unfortunately, the original indexOf behavior needed to be altered a bit. Invalid positions will not raise an exception. There is, however a new method that allows for cheking if a position is in range.
I made some decisions I would like to discuss:
{}
instead of a vector. This forbids to pass the ticks vector as reference. So there is some copying going on, is there a good way to avoid this?edit: test failures are expected :)
edit 2: I think this thing is good for review. Regarding the questions stressed above, the current states are: