summaryrefslogtreecommitdiff
path: root/doc/classes/Array.xml
diff options
context:
space:
mode:
authorpoke1024 <poke1024@gmx.de>2017-11-02 19:04:38 +0100
committerBernhard Liebl <Bernhard.Liebl@gmx.org>2017-11-21 08:50:31 +0100
commitd6e54de50239e8ac1de645bd411eeddbf627e4dc (patch)
treea8ac54ac05e8b13daca8eb78c8235ca934180507 /doc/classes/Array.xml
parent7c90d51b729d31557ad6d45a5fe18d11f6752cf1 (diff)
Add bsearch and bsearch_custom to Array
Diffstat (limited to 'doc/classes/Array.xml')
-rw-r--r--doc/classes/Array.xml26
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>