-
Notifications
You must be signed in to change notification settings - Fork 647
add ShuffleOrder.cloneAndSet() to provide startIndex to shuffle order #2834
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
base: main
Are you sure you want to change the base?
Conversation
* if access to the {@code startIndex} is desired. | ||
* | ||
* @param insertionCount The number of elements. | ||
* @param startIndex The index playback will start from after replacement, or {@link |
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.
-
It's better to keep the statement general and avoid mentioning "playback" here. How do you think of "The index of the new element in the unshuffled order that should be the first in the shuffled order"
-
Instead of saying
INDEX_UNSET
should be passed when the new list is empty, shall we saystartIndex
will be ignored if the new list is empty or it is larger than the size (inclusive) of the new list? And we can still allow aINDEX_UNSET
which explicitly suggests that the first element of the shuffled order is not specified.
What do you think?
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.
Hi, thanks for the feedback. These suggestions make sense to me and I've applied them.
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.
Thanks for the change! Still for the INDEX_UNSET
case, instead of saying "or {@link C#INDEX_UNSET} if the index is unknown", would it be better to say "or {@link C#INDEX_UNSET} if the the first element in the shuffled order is not specified"? Personally it sounds more general and gives out a sign that not enforcing the first element is allowed.
Also for L292 - "if access to the {@code startIndex} is desired", what do you think of making it more straightforward, eg. "if the first element in the shuffled order should be set to the one whose index in the unshuffled order is {@code startIndex}"?
Once this is in the internal review stage, we can get a third opinion on this as well.
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.
Thanks for the change! Still for the INDEX_UNSET case, instead of saying "or {@link C#INDEX_UNSET} if the index is unknown", would it be better to say "or {@link C#INDEX_UNSET} if the the first element in the shuffled order is not specified"? Personally it sounds more general and gives out a sign that not enforcing the first element is allowed.
Makes sense to me.
Also for L292 - "if access to the {@code startIndex} is desired", what do you think of making it more straightforward, eg. "if the first element in the shuffled order should be set to the one whose index in the unshuffled order is {@code startIndex}"?
I am a bit concerned that this changes the messaging too much in the direction of "startIndex being first in the shuffled list is the only correct way". While I don't actually see a reason to do otherwise, it has been the default for a long time now, and DefaultShuffleOrder will still do it after this change - or maybe I should change DefaultShuffleOrder to respect startIndex and change the text to state that startIndex being first in the shuffled list is the recommended way like you said?
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.
Sorry, I misread that, you said "if [it] should be set [...]", and not "it should be set". And changing DefaultShuffleOrder is probably not a good idea on second thought due to backwards compatibility. Pushed the new wording, let me know whether it looks good.
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.
Cool, this looks good to me! I'm going to send this for internal review now. You may see some more commits being added as I make changes in response to review feedback. Please refrain from pushing any more substantive changes as it will complicate the internal review - thanks!
5751ae5
to
f31ce3d
Compare
Shuffle order may want to ensure that the song that's going to be played (was chosen by user) is also the first song in shuffle playlist, as that makes sure all other songs will be playing afterwards. If first song gets random position in shuffled playlist, playback may stop before playing every song as it will start in the middle of shuffled list.
Shuffle order may want to ensure that the song that's going to be played (was chosen by user) is also the first song in shuffle playlist, as that makes sure all other songs will be playing afterwards. If first song gets random position in shuffled playlist, playback may stop before playing every song as it will start in the middle of shuffled list.