Accept the indexing pool from which numbers are selected and returned.
Accept the indexing pool from which numbers are selected and returned.
Correct its format to suit the current NumberSelector
algorithms.
All of the numbers are sorted to their proper indexed position in the Array
.
Every other number is an invalid negative-one (-1).
The selectionIndex
is set to the index of the first valid number, or zero if there are none.
The ret
index is set to index zero.
the Array
of Int
numbers
Accept a provided pool
and select the next number.
The main requirement for valid implementation of a Get
selector is atomicity.
Accept a provided pool
and select the next number.
The main requirement for valid implementation of a Get
selector is atomicity.
While Get
could be written to run again for every failure, this should not be anticipated.
A success means a "success."
A failure means that no "success" would be possible no matter how many times it might be run under the current conditions.
The aforementioned conditions may change depending on the nature of the specific selector;
but, the previous requirement should not be violated.
Get
is under no obligation to not modify its parameter Array
.
In fact, it should do this by default to provide additional feedback of its process.
Pass a copy if data mutation is a concern.
the Array
of Int
numbers from which to draw a new number
an Int
number
Give a number back to a specific collection following the principles of this selector.
By default, a simple policy for returning numbers has been provided.
Give a number back to a specific collection following the principles of this selector.
By default, a simple policy for returning numbers has been provided.
This will not be sufficient for all selection actions that can be implemented so override
where necessary.
Return
is under no obligation to leave its parameter Array
unmodified.
In fact, it should modify it by default to provide additional feedback of its process.
Pass a copy if data mutation is a concern.
the number to be returned
the Array
of Int
numbers to which the number is to be returned
true
, if this return was successful; false
, otherwise
The index for the selector when performing a number return action, then modified for the "next" index.
The index for the selector when performing a number return action, then modified for the "next" index.
The index for the selector when performing a number selection action, then modified to the "next" index.
The index for the selector when performing a number selection action, then modified to the "next" index.
Get the next number in this pool incrementally. Starting at index 0, for example, select each subsequent number as it is available. Do not progress if a number is not available when requested.