Issue 75: Add support for sorting Methods by priority #96
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add: get_prioritized_methods
Take an unordered list of Methods and sort them by priority using the priority_order and automatic ordering. The priority_order is used to define groups of priority (sets of methods). The automatic ordering part is used to order the methods within each priority group. In particular, all methods supported by the current platform are placed first, and all supported methods are then ordered alphabetically (ignoring case).
Example
Assuming: Current platform is Linux.
Explanation:
WindowsA and LinuxB were given high priority, but since the current platform is Linux, LinuxB was prioritized to be before WindowsA.
The asterisk ('*') is converted to a set of rest of the methods: {"LinuxA", "LinuxC", "MultiPlatformA"}, and those are then
automatically ordered. As all of them support Linux, the result is just the methods sorted alphabetically. The asterisk in the end is optional; it is added to the end of
priority_order
if missing.