y_simpletree.inc 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  1. #if defined _INC_y_simpletree
  2. #endinput
  3. #endif
  4. #define _INC_y_simpletree
  5. /**
  6. * <library name="y_simpletree">
  7. * <section>
  8. * Description
  9. * </section>
  10. * Provides functions to generate balanced binary search trees for efficient
  11. * searching of large arrays by value. Left branch is less than, right branch
  12. * is greater than or equal to for multiple matching values.
  13. * <section>
  14. * Version
  15. * </section>
  16. * 0.2
  17. * <section>
  18. * Functions
  19. * </section>
  20. * <subsection>
  21. * Core
  22. * </subsection><ul>
  23. * <symbol name="Bintree_QSort">Custom implementaion of QSort to keep pointers.</symbol>
  24. * <symbol name="Bintree_SortHalf">Itteratively balances halves of an array.</symbol>
  25. * </ul><subsection>
  26. * Stock
  27. * </subsection><ul>
  28. * <symbol name="Bintree_Generate">Generates a balanced binary tree from given input.</symbol>
  29. * <symbol name="Bintree_Reset">Resets a position in a tree.</symbol>
  30. * <symbol name="Bintree_FindValue">Finds the pointer for a value in the tree.</symbol>
  31. * <symbol name="Bintree_Add">Adds an item to a generated tree.</symbol>
  32. * <symbol name="Bintree_Delete">Removes an item from a tree.</symbol>
  33. * <symbol name="Bintree_UpdatePointers">Updates the pointers after a target change.</symbol>
  34. * </ul><subsection>
  35. * Static
  36. * </subsection><ul>
  37. * <symbol name="Bintree_Compress">Removes space from an altered tree.</symbol>
  38. * <symbol name="Bintree_FindMin">Finds the smallest value on a branch.</symbol>
  39. * <symbol name="Bintree_FindMax">Finds the largest value on a branch.</symbol>
  40. * </ul><subsection>
  41. * Inline
  42. * </subsection><ul>
  43. * <symbol name="Bintree_Sort">Entry point for Bintree_QSort.</symbol>
  44. * <symbol name="Bintree_Fill">Entry point for Bintree_SortHalf.</symbol>
  45. * </ul><section>
  46. * Definitions
  47. * </section><ul>
  48. * <symbol name="BINTREE_NO_BRANCH">Nowhere to go from the number in required direction.</symbol>
  49. * <symbol name="BINTREE_NOT_FOUND">Failure return.</symbol>
  50. * </ul><section>
  51. * Enums
  52. * </section><ul>
  53. * <symbol name="E_BINTREE_TREE">Structure of a leaf of a binary tree.</symbol>
  54. * <symbol name="E_BINTREE_INPUT">Structure of an array of data to be added to a tree.</symbol>
  55. * </ul><section>
  56. * Tags
  57. * </section><ul>
  58. * <symbol name="Bintree">Binary tree type.</symbol>
  59. * </ul>
  60. * </library>
  61. *//** *//*
  62. Legal:
  63. Version: MPL 1.1
  64. The contents of this file are subject to the Mozilla Public License Version
  65. 1.1 the "License"; you may not use this file except in compliance with
  66. the License. You may obtain a copy of the License at
  67. http://www.mozilla.org/MPL/
  68. Software distributed under the License is distributed on an "AS IS" basis,
  69. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  70. for the specific language governing rights and limitations under the
  71. License.
  72. The Original Code is the YSI framework.
  73. The Initial Developer of the Original Code is Alex "Y_Less" Cole.
  74. Portions created by the Initial Developer are Copyright C 2011
  75. the Initial Developer. All Rights Reserved.
  76. Contributors:
  77. Y_Less
  78. koolk
  79. JoeBullet/Google63
  80. g_aSlice/Slice
  81. Misiur
  82. samphunter
  83. tianmeta
  84. maddinat0r
  85. spacemud
  86. Crayder
  87. Dayvison
  88. Ahmad45123
  89. Zeex
  90. irinel1996
  91. Yiin-
  92. Chaprnks
  93. Konstantinos
  94. Masterchen09
  95. Southclaws
  96. PatchwerkQWER
  97. m0k1
  98. paulommu
  99. udan111
  100. Thanks:
  101. JoeBullet/Google63 - Handy arbitrary ASM jump code using SCTRL.
  102. ZeeX - Very productive conversations.
  103. koolk - IsPlayerinAreaEx code.
  104. TheAlpha - Danish translation.
  105. breadfish - German translation.
  106. Fireburn - Dutch translation.
  107. yom - French translation.
  108. 50p - Polish translation.
  109. Zamaroht - Spanish translation.
  110. Los - Portuguese translation.
  111. Dracoblue, sintax, mabako, Xtreme, other coders - Producing other modes for
  112. me to strive to better.
  113. Pixels^ - Running XScripters where the idea was born.
  114. Matite - Pestering me to release it and using it.
  115. Very special thanks to:
  116. Thiadmer - PAWN, whose limits continue to amaze me!
  117. Kye/Kalcor - SA:MP.
  118. SA:MP Team past, present and future - SA:MP.
  119. Optional plugins:
  120. Gamer_Z - GPS.
  121. Incognito - Streamer.
  122. Me - sscanf2, fixes2, Whirlpool.
  123. */
  124. #include "..\YSI_Internal\y_version"
  125. #include "..\YSI_Core\y_debug"
  126. #include "..\YSI_Core\y_utils"
  127. #include "y_binarytree"
  128. #include "y_simpletree/impl"
  129. #if defined YSI_TESTS
  130. #include "..\YSI_Core\y_testing"
  131. #include "y_simpletree/tests"
  132. #endif