diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/Array.xml | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/doc/classes/Array.xml b/doc/classes/Array.xml index 203c60e644..3bb40755a6 100644 --- a/doc/classes/Array.xml +++ b/doc/classes/Array.xml @@ -260,6 +260,32 @@ Sort the array using a custom method and return reference to the array. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return true if the first argument is less than the second, and return false otherwise. Note: you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior. </description> </method> + <method name="bsearch"> + <return type="int"> + </return> + <argument index="0" name="value" type="var"> + </argument> + <argument index="1" name="before" type="bool" default="true"> + </argument> + <description> + Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a before specifier can be passed. If false, the returned index comes after all existing entries of the value in the array. Note that calling bsearch on an unsorted array results in unexpected behavior. + </description> + </method> + <method name="bsearch_custom"> + <return type="int"> + </return> + <argument index="0" name="value" type="var"> + </argument> + <argument index="1" name="obj" type="Object"> + </argument> + <argument index="2" name="func" type="String"> + </argument> + <argument index="3" name="before" type="bool" default="true"> + </argument> + <description> + Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search and a custom comparison method. Optionally, a before specifier can be passed. If false, the returned index comes after all existing entries of the value in the array. The custom method receives two arguments (an element from the array and the value searched for) and must return true if the first argument is less than the second, and return false otherwise. Note that calling bsearch on an unsorted array results in unexpected behavior. + </description> + </method> </methods> <constants> </constants> |