carats 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (422) hide show
  1. data/ChangeLog +2 -0
  2. data/LICENSE +5 -0
  3. data/README +67 -0
  4. data/Reapfile +72 -0
  5. data/ToDo +24 -0
  6. data/bench/b_harray.rb +49 -0
  7. data/bench/b_range.rb +64 -0
  8. data/demo/ansicolor/cdiff.rb +20 -0
  9. data/demo/ansicolor/example.rb +82 -0
  10. data/demo/io-reactor/chatserver.rb +347 -0
  11. data/doc/classes/Array.html +172 -0
  12. data/doc/classes/BBCode.html +638 -0
  13. data/doc/classes/BinaryReader.html +675 -0
  14. data/doc/classes/Binding.html +223 -0
  15. data/doc/classes/ByteOrder.html +284 -0
  16. data/doc/classes/Class.html +189 -0
  17. data/doc/classes/Constant.html +785 -0
  18. data/doc/classes/Constant/CGS.html +609 -0
  19. data/doc/classes/Continuation.html +113 -0
  20. data/doc/classes/Coroutine.html +387 -0
  21. data/doc/classes/CountingSemaphore.html +337 -0
  22. data/doc/classes/CrossCase.html +561 -0
  23. data/doc/classes/DynamicMixin.html +185 -0
  24. data/doc/classes/EnumerableWithArgs.html +550 -0
  25. data/doc/classes/Expect.html +428 -0
  26. data/doc/classes/Expect/DefaultChain.html +113 -0
  27. data/doc/classes/Expect/SeparatedPattern.html +223 -0
  28. data/doc/classes/Expect/Timeout.html +167 -0
  29. data/doc/classes/Expect/UnmatchedMessage.html +160 -0
  30. data/doc/classes/FileList.html +833 -0
  31. data/doc/classes/FloatString.html +534 -0
  32. data/doc/classes/Functor.html +211 -0
  33. data/doc/classes/HArray.html +1872 -0
  34. data/doc/classes/HTML.html +328 -0
  35. data/doc/classes/Heap.html +683 -0
  36. data/doc/classes/Heap/EmptyHeapException.html +111 -0
  37. data/doc/classes/Heap/Max.html +176 -0
  38. data/doc/classes/Heap/Min.html +176 -0
  39. data/doc/classes/IO.html +108 -0
  40. data/doc/classes/IO/Reactor.html +790 -0
  41. data/doc/classes/IO/Redirect.html +289 -0
  42. data/doc/classes/Infinity.html +320 -0
  43. data/doc/classes/Interval.html +1014 -0
  44. data/doc/classes/InvalidNackError.html +161 -0
  45. data/doc/classes/Kernel.html +204 -0
  46. data/doc/classes/Lisp.html +1132 -0
  47. data/doc/classes/Lisp/DottedPair.html +379 -0
  48. data/doc/classes/Lisp/Format.html +178 -0
  49. data/doc/classes/Lisp/Format/ArgumentError.html +126 -0
  50. data/doc/classes/Lisp/Format/Directives.html +155 -0
  51. data/doc/classes/Lisp/Format/Directives/ArgJump.html +178 -0
  52. data/doc/classes/Lisp/Format/Directives/Ascii.html +119 -0
  53. data/doc/classes/Lisp/Format/Directives/BeginCaseConversion.html +185 -0
  54. data/doc/classes/Lisp/Format/Directives/BeginConditional.html +307 -0
  55. data/doc/classes/Lisp/Format/Directives/BeginIteration.html +338 -0
  56. data/doc/classes/Lisp/Format/Directives/Binary.html +157 -0
  57. data/doc/classes/Lisp/Format/Directives/Character.html +228 -0
  58. data/doc/classes/Lisp/Format/Directives/CharacterDirective.html +203 -0
  59. data/doc/classes/Lisp/Format/Directives/ClauseSeparator.html +166 -0
  60. data/doc/classes/Lisp/Format/Directives/Decimal.html +119 -0
  61. data/doc/classes/Lisp/Format/Directives/Directive.html +397 -0
  62. data/doc/classes/Lisp/Format/Directives/DollarFP.html +205 -0
  63. data/doc/classes/Lisp/Format/Directives/EndCaseConversion.html +174 -0
  64. data/doc/classes/Lisp/Format/Directives/EndConditional.html +159 -0
  65. data/doc/classes/Lisp/Format/Directives/EndIteration.html +163 -0
  66. data/doc/classes/Lisp/Format/Directives/ExpFP.html +252 -0
  67. data/doc/classes/Lisp/Format/Directives/FFFP.html +224 -0
  68. data/doc/classes/Lisp/Format/Directives/Factory.html +180 -0
  69. data/doc/classes/Lisp/Format/Directives/FreshLine.html +175 -0
  70. data/doc/classes/Lisp/Format/Directives/GeneralFP.html +265 -0
  71. data/doc/classes/Lisp/Format/Directives/Hexadecimal.html +157 -0
  72. data/doc/classes/Lisp/Format/Directives/Indirection.html +183 -0
  73. data/doc/classes/Lisp/Format/Directives/Literal.html +187 -0
  74. data/doc/classes/Lisp/Format/Directives/NewLine.html +158 -0
  75. data/doc/classes/Lisp/Format/Directives/NewPage.html +158 -0
  76. data/doc/classes/Lisp/Format/Directives/Number.html +243 -0
  77. data/doc/classes/Lisp/Format/Directives/Octal.html +157 -0
  78. data/doc/classes/Lisp/Format/Directives/Plural.html +177 -0
  79. data/doc/classes/Lisp/Format/Directives/Print.html +237 -0
  80. data/doc/classes/Lisp/Format/Directives/Radix.html +432 -0
  81. data/doc/classes/Lisp/Format/Directives/SExpression.html +157 -0
  82. data/doc/classes/Lisp/Format/Directives/SkipWhitespace.html +165 -0
  83. data/doc/classes/Lisp/Format/Directives/Tabulate.html +198 -0
  84. data/doc/classes/Lisp/Format/Directives/Tilde.html +158 -0
  85. data/doc/classes/Lisp/Format/Directives/UnknownDirectiveError.html +117 -0
  86. data/doc/classes/Lisp/Format/Formatter.html +193 -0
  87. data/doc/classes/Lisp/Format/IncompleteParameterError.html +119 -0
  88. data/doc/classes/Lisp/Format/IndexError.html +126 -0
  89. data/doc/classes/Lisp/Format/Lexer.html +479 -0
  90. data/doc/classes/Lisp/Format/MalformedError.html +119 -0
  91. data/doc/classes/Lisp/Format/MissingParameterError.html +119 -0
  92. data/doc/classes/Lisp/Format/ModifierError.html +119 -0
  93. data/doc/classes/Lisp/Format/Output.html +239 -0
  94. data/doc/classes/Lisp/Format/ParameterError.html +126 -0
  95. data/doc/classes/Lisp/Format/Parameters.html +123 -0
  96. data/doc/classes/Lisp/Format/Parameters/Argument.html +172 -0
  97. data/doc/classes/Lisp/Format/Parameters/ArgumentCount.html +159 -0
  98. data/doc/classes/Lisp/Format/Parameters/Character.html +119 -0
  99. data/doc/classes/Lisp/Format/Parameters/Default.html +120 -0
  100. data/doc/classes/Lisp/Format/Parameters/Integer.html +119 -0
  101. data/doc/classes/Lisp/Format/Parameters/Parameter.html +206 -0
  102. data/doc/classes/Lisp/Format/Parser.html +212 -0
  103. data/doc/classes/Lisp/Format/Positioned.html +166 -0
  104. data/doc/classes/Lisp/Format/State.html +455 -0
  105. data/doc/classes/Lisp/Format/SyntaxError.html +126 -0
  106. data/doc/classes/Method.html +274 -0
  107. data/doc/classes/Method/DuckHunter.html +281 -0
  108. data/doc/classes/Module.html +709 -0
  109. data/doc/classes/Multiton.html +284 -0
  110. data/doc/classes/Multiton/New.html +164 -0
  111. data/doc/classes/Multiton/Semi.html +155 -0
  112. data/doc/classes/NackClass.html +322 -0
  113. data/doc/classes/NilClass.html +231 -0
  114. data/doc/classes/NilComparable.html +179 -0
  115. data/doc/classes/NotCopyable.html +273 -0
  116. data/doc/classes/Object.html +261 -0
  117. data/doc/classes/OpenStructable.html +346 -0
  118. data/doc/classes/OrderedHash.html +939 -0
  119. data/doc/classes/Parser.html +515 -0
  120. data/doc/classes/Parser/Main.html +178 -0
  121. data/doc/classes/Parser/Marker.html +475 -0
  122. data/doc/classes/Parser/Registry.html +354 -0
  123. data/doc/classes/Parser/Token.html +399 -0
  124. data/doc/classes/Parser/UnitToken.html +222 -0
  125. data/doc/classes/Ref.html +230 -0
  126. data/doc/classes/SimpleStringIO.html +183 -0
  127. data/doc/classes/StaticHash.html +202 -0
  128. data/doc/classes/String.html +172 -0
  129. data/doc/classes/Struct.html +181 -0
  130. data/doc/classes/SuperStruct.html +382 -0
  131. data/doc/classes/Term.html +156 -0
  132. data/doc/classes/Term/ANSIColor.html +185 -0
  133. data/doc/classes/Text.html +138 -0
  134. data/doc/classes/Text/Soundex.html +222 -0
  135. data/doc/classes/TextTagIterator.html +911 -0
  136. data/doc/classes/Time.html +119 -0
  137. data/doc/classes/Time/Limit.html +303 -0
  138. data/doc/classes/Time/Limit/Dummy.html +181 -0
  139. data/doc/classes/Timer.html +351 -0
  140. data/doc/classes/TracePoint.html +532 -0
  141. data/doc/classes/Tuple.html +178 -0
  142. data/doc/classes/Uninheritable.html +213 -0
  143. data/doc/classes/Version.html +783 -0
  144. data/doc/created.rid +1 -0
  145. data/doc/files/LICENSE.html +113 -0
  146. data/doc/files/README.html +201 -0
  147. data/doc/files/lib/carat/1st_rb.html +107 -0
  148. data/doc/files/lib/carat/ansicolor_rb.html +146 -0
  149. data/doc/files/lib/carat/attr_rb.html +101 -0
  150. data/doc/files/lib/carat/bbcode_rb.html +152 -0
  151. data/doc/files/lib/carat/binaryreader_rb.html +114 -0
  152. data/doc/files/lib/carat/binding-of-caller_rb.html +108 -0
  153. data/doc/files/lib/carat/byteorder_rb.html +107 -0
  154. data/doc/files/lib/carat/constant_rb.html +167 -0
  155. data/doc/files/lib/carat/coroutine_rb.html +156 -0
  156. data/doc/files/lib/carat/crosscase_rb.html +224 -0
  157. data/doc/files/lib/carat/duckhunter_rb.html +165 -0
  158. data/doc/files/lib/carat/dynamic-mixin_rb.html +101 -0
  159. data/doc/files/lib/carat/enumerable-args_rb.html +140 -0
  160. data/doc/files/lib/carat/expect_rb.html +137 -0
  161. data/doc/files/lib/carat/filelist_rb.html +130 -0
  162. data/doc/files/lib/carat/floatstring_rb.html +126 -0
  163. data/doc/files/lib/carat/functor_rb.html +140 -0
  164. data/doc/files/lib/carat/harray_rb.html +128 -0
  165. data/doc/files/lib/carat/heap_rb.html +154 -0
  166. data/doc/files/lib/carat/html-helpers_rb.html +116 -0
  167. data/doc/files/lib/carat/infinity_rb.html +142 -0
  168. data/doc/files/lib/carat/init_rb.html +127 -0
  169. data/doc/files/lib/carat/interval_rb.html +162 -0
  170. data/doc/files/lib/carat/io-reactor_rb.html +211 -0
  171. data/doc/files/lib/carat/io-redirect_rb.html +132 -0
  172. data/doc/files/lib/carat/lisp-format_rb.html +187 -0
  173. data/doc/files/lib/carat/lisp_rb.html +152 -0
  174. data/doc/files/lib/carat/macro_rb.html +129 -0
  175. data/doc/files/lib/carat/multiton_rb.html +178 -0
  176. data/doc/files/lib/carat/nack_rb.html +193 -0
  177. data/doc/files/lib/carat/nil-comparable_rb.html +126 -0
  178. data/doc/files/lib/carat/nil-missing_rb.html +101 -0
  179. data/doc/files/lib/carat/notcopyable_rb.html +166 -0
  180. data/doc/files/lib/carat/orderedhash_rb.html +107 -0
  181. data/doc/files/lib/carat/ostructable_rb.html +157 -0
  182. data/doc/files/lib/carat/parser-old_rb.html +239 -0
  183. data/doc/files/lib/carat/parser_rb.html +244 -0
  184. data/doc/files/lib/carat/ref_rb.html +107 -0
  185. data/doc/files/lib/carat/semaphore_rb.html +132 -0
  186. data/doc/files/lib/carat/snapshot_rb.html +152 -0
  187. data/doc/files/lib/carat/soundex_rb.html +128 -0
  188. data/doc/files/lib/carat/sstruct_rb.html +142 -0
  189. data/doc/files/lib/carat/statichash_rb.html +150 -0
  190. data/doc/files/lib/carat/tagiter_rb.html +236 -0
  191. data/doc/files/lib/carat/timelimit_rb.html +136 -0
  192. data/doc/files/lib/carat/timer_rb.html +153 -0
  193. data/doc/files/lib/carat/tracepoint_rb.html +160 -0
  194. data/doc/files/lib/carat/tuple_rb.html +123 -0
  195. data/doc/files/lib/carat/uninheritable_rb.html +101 -0
  196. data/doc/files/lib/carat/version_rb.html +141 -0
  197. data/doc/fr_class_index.html +159 -0
  198. data/doc/fr_file_index.html +78 -0
  199. data/doc/fr_method_index.html +663 -0
  200. data/doc/index.html +24 -0
  201. data/doc/rdoc-style.css +208 -0
  202. data/lib/carat-dev/README +11 -0
  203. data/lib/carat-dev/access-blocks/access_blocks.rb +42 -0
  204. data/lib/carat-dev/association/association.rb +70 -0
  205. data/lib/carat-dev/blankslate/blankslate.rb +51 -0
  206. data/lib/carat-dev/breakpoint.rb +518 -0
  207. data/lib/carat-dev/class-constructor/constructor_methods.rb +78 -0
  208. data/lib/carat-dev/class-constructor/tc_constructor.rb +35 -0
  209. data/lib/carat-dev/closecall/closecall-test.rb +39 -0
  210. data/lib/carat-dev/closecall/closecall.rb +101 -0
  211. data/lib/carat-dev/commandrunner/commandrunner.rb +100 -0
  212. data/lib/carat-dev/conditional/conditionals.rb +106 -0
  213. data/lib/carat-dev/daemon/daemon.rb +70 -0
  214. data/lib/carat-dev/detach/detach.rb +363 -0
  215. data/lib/carat-dev/detach/tc_detach.rb +57 -0
  216. data/lib/carat-dev/import-module/import-module-0.81.tar.gz +0 -0
  217. data/lib/carat-dev/import-module/import-module-0.81/LICENSE +1 -0
  218. data/lib/carat-dev/import-module/import-module-0.81/Makefile +11 -0
  219. data/lib/carat-dev/import-module/import-module-0.81/README +4 -0
  220. data/lib/carat-dev/import-module/import-module-0.81/dev-lib/import-module-hash.rb +49 -0
  221. data/lib/carat-dev/import-module/import-module-0.81/dev-lib/import-module-pip.rb +71 -0
  222. data/lib/carat-dev/import-module/import-module-0.81/dev-lib/import-module-unbound-method.rb +36 -0
  223. data/lib/carat-dev/import-module/import-module-0.81/doc/README-ja.html +293 -0
  224. data/lib/carat-dev/import-module/import-module-0.81/doc/README-ja.rd +306 -0
  225. data/lib/carat-dev/import-module/import-module-0.81/doc/README.html +290 -0
  226. data/lib/carat-dev/import-module/import-module-0.81/doc/README.rd +303 -0
  227. data/lib/carat-dev/import-module/import-module-0.81/doc/style.css +85 -0
  228. data/lib/carat-dev/import-module/import-module-0.81/install.rb +99 -0
  229. data/lib/carat-dev/import-module/import-module-0.81/lib/import-module-single-thread.rb +84 -0
  230. data/lib/carat-dev/import-module/import-module-0.81/lib/import-module.rb +493 -0
  231. data/lib/carat-dev/import-module/import-module-0.81/test/Makefile +2 -0
  232. data/lib/carat-dev/import-module/import-module-0.81/test/test +91 -0
  233. data/lib/carat-dev/import-module/import-module-0.81/test/test-import-module.rb +936 -0
  234. data/lib/carat-dev/import-module/import-module-0.81/test/test-import_scope.rb +33 -0
  235. data/lib/carat-dev/import-module/import-module-0.81/test/test-scope_import.rb +33 -0
  236. data/lib/carat-dev/import-module/import-module-0.81/test/test-time.rb +184 -0
  237. data/lib/carat-dev/import-module/import-module-0.81/test/test.sh +91 -0
  238. data/lib/carat-dev/import-module/import-module-0.81/test/time.rb +135 -0
  239. data/lib/carat-dev/import-module/import-module-0.81/test/times-do.sh +10 -0
  240. data/lib/carat-dev/interface_work/SCRAP/i-contracts.rb +37 -0
  241. data/lib/carat-dev/interface_work/SCRAP/interface.rb +105 -0
  242. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0.zip +0 -0
  243. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/CHANGES +3 -0
  244. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/MANIFEST +15 -0
  245. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/README +32 -0
  246. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/doc/interface.rd +73 -0
  247. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/doc/interface.txt +94 -0
  248. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/install.rb +16 -0
  249. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/lib/interface.rb +50 -0
  250. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/tc_interface.rb +51 -0
  251. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test.rb +29 -0
  252. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test_instance.rb +24 -0
  253. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test_sub.rb +29 -0
  254. data/lib/carat-dev/interface_work/SCRAP/j-interface/interface-0.1.0/test/test_unrequire.rb +28 -0
  255. data/lib/carat-dev/interface_work/contracts/contract.zip +0 -0
  256. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.html +376 -0
  257. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000001.html +23 -0
  258. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000002.html +18 -0
  259. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000003.html +19 -0
  260. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000004.html +29 -0
  261. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000005.html +18 -0
  262. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract.src/M000006.html +18 -0
  263. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract/ContractError.html +142 -0
  264. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract/ContractException.html +153 -0
  265. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Contract/ContractMismatch.html +125 -0
  266. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Module.html +157 -0
  267. data/lib/carat-dev/interface_work/contracts/contract/doc/classes/Module.src/M000007.html +112 -0
  268. data/lib/carat-dev/interface_work/contracts/contract/doc/created.rid +1 -0
  269. data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/assertions_rb.html +109 -0
  270. data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/exception_rb.html +108 -0
  271. data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/integration_rb.html +108 -0
  272. data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract/overrides_rb.html +109 -0
  273. data/lib/carat-dev/interface_work/contracts/contract/doc/files/lib/contract_rb.html +114 -0
  274. data/lib/carat-dev/interface_work/contracts/contract/doc/fr_class_index.html +31 -0
  275. data/lib/carat-dev/interface_work/contracts/contract/doc/fr_file_index.html +31 -0
  276. data/lib/carat-dev/interface_work/contracts/contract/doc/fr_method_index.html +33 -0
  277. data/lib/carat-dev/interface_work/contracts/contract/doc/index.html +24 -0
  278. data/lib/carat-dev/interface_work/contracts/contract/doc/rdoc-style.css +208 -0
  279. data/lib/carat-dev/interface_work/contracts/contract/lib/contract.rb +88 -0
  280. data/lib/carat-dev/interface_work/contracts/contract/lib/contract/assertions.rb +37 -0
  281. data/lib/carat-dev/interface_work/contracts/contract/lib/contract/exception.rb +92 -0
  282. data/lib/carat-dev/interface_work/contracts/contract/lib/contract/integration.rb +132 -0
  283. data/lib/carat-dev/interface_work/contracts/contract/lib/contract/overrides.rb +32 -0
  284. data/lib/carat-dev/interface_work/must.rb +37 -0
  285. data/lib/carat-dev/interface_work/type.rb +232 -0
  286. data/lib/carat-dev/main/tc_toplevel.rb +23 -0
  287. data/lib/carat-dev/main/toplevel.rb +33 -0
  288. data/lib/carat-dev/main/toplevel_test.rb +24 -0
  289. data/lib/carat-dev/misc/1.rb +40 -0
  290. data/lib/carat-dev/misc/misc.rb +44 -0
  291. data/lib/carat-dev/misc/sys.rb +186 -0
  292. data/lib/carat-dev/misc/temp.rb +1 -0
  293. data/lib/carat-dev/misc/utils.rb +518 -0
  294. data/lib/carat-dev/predicate/predicate.rb +109 -0
  295. data/lib/carat-dev/predicate/predicate_test.rb +67 -0
  296. data/lib/carat-dev/premshree.rb +40 -0
  297. data/lib/carat-dev/priority-queue/pqueue.rb +183 -0
  298. data/lib/carat-dev/priority-queue/priorityqueue.rb +84 -0
  299. data/lib/carat-dev/quaternion/quaternion.rb +529 -0
  300. data/lib/carat-dev/range.rb +259 -0
  301. data/lib/carat-dev/system/rubyinfo.rb +75 -0
  302. data/lib/carat-dev/system/system.rb +105 -0
  303. data/lib/carat-dev/tc_range.rb +118 -0
  304. data/lib/carat-dev/timer/timer-doc/classes/Timer.html +291 -0
  305. data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000001.html +26 -0
  306. data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000002.html +19 -0
  307. data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000003.html +18 -0
  308. data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000004.html +18 -0
  309. data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000005.html +21 -0
  310. data/lib/carat-dev/timer/timer-doc/classes/Timer.src/M000006.html +23 -0
  311. data/lib/carat-dev/timer/timer-doc/created.rid +1 -0
  312. data/lib/carat-dev/timer/timer-doc/files/timer_rb.html +144 -0
  313. data/lib/carat-dev/timer/timer-doc/fr_class_index.html +27 -0
  314. data/lib/carat-dev/timer/timer-doc/fr_file_index.html +27 -0
  315. data/lib/carat-dev/timer/timer-doc/fr_method_index.html +32 -0
  316. data/lib/carat-dev/timer/timer-doc/index.html +24 -0
  317. data/lib/carat-dev/timer/timer-doc/rdoc-style.css +208 -0
  318. data/lib/carat-dev/timer/timer.rb +160 -0
  319. data/lib/carat-dev/vars/vars.rb +62 -0
  320. data/lib/carat/1st.rb +58 -0
  321. data/lib/carat/ansicolor.rb +122 -0
  322. data/lib/carat/attr.rb +342 -0
  323. data/lib/carat/bbcode.rb +352 -0
  324. data/lib/carat/binaryreader.rb +170 -0
  325. data/lib/carat/binding-of-caller.rb +83 -0
  326. data/lib/carat/byteorder.rb +34 -0
  327. data/lib/carat/constant.rb +287 -0
  328. data/lib/carat/coroutine.rb +102 -0
  329. data/lib/carat/crosscase.rb +309 -0
  330. data/lib/carat/duckhunter.rb +158 -0
  331. data/lib/carat/dynamic-mixin.rb +71 -0
  332. data/lib/carat/enumerable-args.rb +125 -0
  333. data/lib/carat/expect.rb +192 -0
  334. data/lib/carat/filelist.rb +277 -0
  335. data/lib/carat/floatstring.rb +153 -0
  336. data/lib/carat/functor.rb +41 -0
  337. data/lib/carat/harray.rb +507 -0
  338. data/lib/carat/heap.rb +193 -0
  339. data/lib/carat/html-helpers.rb +82 -0
  340. data/lib/carat/infinity.rb +61 -0
  341. data/lib/carat/init.rb +33 -0
  342. data/lib/carat/interval.rb +248 -0
  343. data/lib/carat/io-reactor.rb +657 -0
  344. data/lib/carat/io-redirect.rb +99 -0
  345. data/lib/carat/lisp-format.rb +1832 -0
  346. data/lib/carat/lisp.rb +336 -0
  347. data/lib/carat/macro.rb +68 -0
  348. data/lib/carat/multiton.rb +153 -0
  349. data/lib/carat/nack.rb +115 -0
  350. data/lib/carat/nil-comparable.rb +67 -0
  351. data/lib/carat/nil-missing.rb +12 -0
  352. data/lib/carat/notcopyable.rb +68 -0
  353. data/lib/carat/orderedhash.rb +249 -0
  354. data/lib/carat/ostructable.rb +138 -0
  355. data/lib/carat/parser-old.rb +350 -0
  356. data/lib/carat/parser.rb +393 -0
  357. data/lib/carat/ref.rb +31 -0
  358. data/lib/carat/semaphore.rb +69 -0
  359. data/lib/carat/snapshot.rb +94 -0
  360. data/lib/carat/soundex.rb +104 -0
  361. data/lib/carat/sstruct.rb +223 -0
  362. data/lib/carat/statichash.rb +49 -0
  363. data/lib/carat/tagiter.rb +345 -0
  364. data/lib/carat/timelimit.rb +114 -0
  365. data/lib/carat/timer.rb +99 -0
  366. data/lib/carat/tracepoint.rb +154 -0
  367. data/lib/carat/tuple.rb +31 -0
  368. data/lib/carat/uninheritable.rb +68 -0
  369. data/lib/carat/version.rb +147 -0
  370. data/pub/doc/sstruct.txt +204 -0
  371. data/pub/doc/tagiter.html +145 -0
  372. data/setup.rb +1361 -0
  373. data/test/fixtures/filelist/testfile.txt +1 -0
  374. data/test/fixtures/filelist/testfile2.txt +1 -0
  375. data/test/tc_1st.rb +16 -0
  376. data/test/tc_ansicolor.rb +23 -0
  377. data/test/tc_attr.rb +46 -0
  378. data/test/tc_bbcode.rb +20 -0
  379. data/test/tc_binaryreader.rb +14 -0
  380. data/test/tc_binding_of_caller.rb +2 -0
  381. data/test/tc_byteorder.rb +41 -0
  382. data/test/tc_constant.rb +12 -0
  383. data/test/tc_coroutine.rb +50 -0
  384. data/test/tc_crosscase.rb +33 -0
  385. data/test/tc_duckhunter.rb +37 -0
  386. data/test/tc_dynamic-mixin.rb +66 -0
  387. data/test/tc_enumerable-args.rb +66 -0
  388. data/test/tc_expect.rb +83 -0
  389. data/test/tc_filelist.rb +17 -0
  390. data/test/tc_floatstring.rb +22 -0
  391. data/test/tc_functor.rb +18 -0
  392. data/test/tc_harray.rb +280 -0
  393. data/test/tc_heap.rb +6 -0
  394. data/test/tc_infinity.rb +23 -0
  395. data/test/tc_init.rb +29 -0
  396. data/test/tc_interval.rb +153 -0
  397. data/test/tc_io-reactor.rb +5 -0
  398. data/test/tc_io-redirect.rb +5 -0
  399. data/test/tc_lisp-format.rb +24 -0
  400. data/test/tc_lisp.rb +32 -0
  401. data/test/tc_macro.rb +48 -0
  402. data/test/tc_multiton.rb +188 -0
  403. data/test/tc_nack.rb +31 -0
  404. data/test/tc_nil-as-emptiness.rb +19 -0
  405. data/test/tc_nil-comparable.rb +29 -0
  406. data/test/tc_nil-missing.rb +0 -0
  407. data/test/tc_notcopyable.rb +64 -0
  408. data/test/tc_orderedhash.rb +36 -0
  409. data/test/tc_ostructable.rb +31 -0
  410. data/test/tc_semaphore.rb +5 -0
  411. data/test/tc_snapshot.rb +20 -0
  412. data/test/tc_soundex.rb +19 -0
  413. data/test/tc_sstruct.rb +313 -0
  414. data/test/tc_statichash.rb +24 -0
  415. data/test/tc_tagiter.rb +80 -0
  416. data/test/tc_timelimit.rb +47 -0
  417. data/test/tc_timer.rb +35 -0
  418. data/test/tc_tracepoint.rb +10 -0
  419. data/test/tc_tuple.rb +25 -0
  420. data/test/tc_uninheritable.rb +33 -0
  421. data/test/tc_version.rb +90 -0
  422. metadata +531 -0
@@ -0,0 +1,211 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Functor</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Functor</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/carat/functor_rb.html">
59
+ lib/carat/functor.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ <a href="Object.html">
69
+ Object
70
+ </a>
71
+ </td>
72
+ </tr>
73
+ </table>
74
+ </div>
75
+ <!-- banner header -->
76
+
77
+ <div id="bodyContent">
78
+
79
+
80
+
81
+ <div id="contextContent">
82
+
83
+ <div id="description">
84
+ <h1><a href="Functor.html">Functor</a></h1>
85
+ <p>
86
+ By definition a <a href="Functor.html">Functor</a> is simply a first class
87
+ method, but these are common in the form of <a
88
+ href="Method.html">Method</a> and Proc. So here a <a
89
+ href="Functor.html">Functor</a> is a bit more specialied as a 1st class
90
+ <em>metafunction</em>. Essentally, a <a href="Functor.html">Functor</a> can
91
+ vary its behavior accorrding to the operation applied to it.
92
+ </p>
93
+ <h2>Synopsis</h2>
94
+ <pre>
95
+ require 'carat/functor'
96
+
97
+ f = Functor.new { |op, x| x.send(op, x) }
98
+ f + 1 #=&gt; 2
99
+ f + 2 #=&gt; 4
100
+ f + 3 #=&gt; 6
101
+ f * 1 #=&gt; 1
102
+ f * 2 #=&gt; 2
103
+ f * 3 #=&gt; 9
104
+ </pre>
105
+ <h2>Notes</h2>
106
+ <p>
107
+ It would probably be a little better if we had a kernelless base object
108
+ class. Built-in public <a href="Object.html">Object</a> methods will not
109
+ work in a <a href="Functor.html">Functor</a> b/c of this. Or perhaps this
110
+ can improved via delegation.
111
+ </p>
112
+ <h2>History</h2>
113
+ <ul>
114
+ <li>2005-04-11 Passed basic tests.
115
+
116
+ </li>
117
+ </ul>
118
+
119
+ </div>
120
+
121
+
122
+ </div>
123
+
124
+ <div id="method-list">
125
+ <h3 class="section-bar">Methods</h3>
126
+
127
+ <div class="name-list">
128
+ <a href="#M000327">method_missing</a>&nbsp;&nbsp;
129
+ <a href="#M000326">new</a>&nbsp;&nbsp;
130
+ </div>
131
+ </div>
132
+
133
+ </div>
134
+
135
+
136
+ <!-- if includes -->
137
+
138
+ <div id="section">
139
+
140
+
141
+
142
+
143
+
144
+
145
+
146
+
147
+ <!-- if method_list -->
148
+ <div id="methods">
149
+ <h3 class="section-bar">Public Class methods</h3>
150
+
151
+ <div id="method-M000326" class="method-detail">
152
+ <a name="M000326"></a>
153
+
154
+ <div class="method-heading">
155
+ <a href="#M000326" class="method-signature">
156
+ <span class="method-name">new</span><span class="method-args">(&amp;func)</span>
157
+ </a>
158
+ </div>
159
+
160
+ <div class="method-description">
161
+ <p><a class="source-toggle" href="#"
162
+ onclick="toggleCode('M000326-source');return false;">[Source]</a></p>
163
+ <div class="method-source-code" id="M000326-source">
164
+ <pre>
165
+ <span class="ruby-comment cmt"># File lib/carat/functor.rb, line 35</span>
166
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">func</span>)
167
+ <span class="ruby-ivar">@func</span> = <span class="ruby-identifier">func</span>
168
+ <span class="ruby-keyword kw">end</span>
169
+ </pre>
170
+ </div>
171
+ </div>
172
+ </div>
173
+
174
+ <h3 class="section-bar">Public Instance methods</h3>
175
+
176
+ <div id="method-M000327" class="method-detail">
177
+ <a name="M000327"></a>
178
+
179
+ <div class="method-heading">
180
+ <a href="#M000327" class="method-signature">
181
+ <span class="method-name">method_missing</span><span class="method-args">(op, *args)</span>
182
+ </a>
183
+ </div>
184
+
185
+ <div class="method-description">
186
+ <p><a class="source-toggle" href="#"
187
+ onclick="toggleCode('M000327-source');return false;">[Source]</a></p>
188
+ <div class="method-source-code" id="M000327-source">
189
+ <pre>
190
+ <span class="ruby-comment cmt"># File lib/carat/functor.rb, line 38</span>
191
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_missing</span>(<span class="ruby-identifier">op</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
192
+ <span class="ruby-ivar">@func</span>.<span class="ruby-identifier">call</span>(<span class="ruby-identifier">op</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
193
+ <span class="ruby-keyword kw">end</span>
194
+ </pre>
195
+ </div>
196
+ </div>
197
+ </div>
198
+
199
+
200
+ </div>
201
+
202
+
203
+ </div>
204
+
205
+
206
+ <div id="validator-badges">
207
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
208
+ </div>
209
+
210
+ </body>
211
+ </html>
@@ -0,0 +1,1872 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: HArray</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">HArray</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/carat/harray_rb.html">
59
+ lib/carat/harray.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Hash
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <h1><a href="HArray.html">HArray</a></h1>
83
+ <p>
84
+ <a href="HArray.html">HArray</a> is an implemenation of the <a
85
+ href="Array.html">Array</a> class using only Hashes. Regular Arrays are
86
+ never used except once to delegate the <a
87
+ href="HArray.html#M000279">pack</a> method, and for *args parameters (since
88
+ there is no way around those is some cases). <a
89
+ href="HArray.html">HArray</a> is for all practical purposes 100% compatible
90
+ with <a href="Array.html">Array</a>.
91
+ </p>
92
+ <p>
93
+ <a href="HArray.html">HArray</a> is slower then the built in <a
94
+ href="Array.html">Array</a> class, but not as slow as one might expect,
95
+ since a Hash in general is faster than an <a href="Array.html">Array</a>.
96
+ It might be interesting to see how this would perform if it were written in
97
+ c. Not all that useful, but an interesting example.
98
+ </p>
99
+ <h2>AUTHOR(s)</h2>
100
+ <ul>
101
+ <li>Thamas Sawyer
102
+
103
+ </li>
104
+ </ul>
105
+
106
+ </div>
107
+
108
+
109
+ </div>
110
+
111
+ <div id="method-list">
112
+ <h3 class="section-bar">Methods</h3>
113
+
114
+ <div class="name-list">
115
+ <a href="#M000246">&amp;</a>&nbsp;&nbsp;
116
+ <a href="#M000247">*</a>&nbsp;&nbsp;
117
+ <a href="#M000248">+</a>&nbsp;&nbsp;
118
+ <a href="#M000249">-</a>&nbsp;&nbsp;
119
+ <a href="#M000250">&lt;&lt;</a>&nbsp;&nbsp;
120
+ <a href="#M000251">&lt;=&gt;</a>&nbsp;&nbsp;
121
+ <a href="#M000252">===</a>&nbsp;&nbsp;
122
+ <a href="#M000243">[]</a>&nbsp;&nbsp;
123
+ <a href="#M000253">[]</a>&nbsp;&nbsp;
124
+ <a href="#M000254">[]=</a>&nbsp;&nbsp;
125
+ <a href="#M000256">assoc</a>&nbsp;&nbsp;
126
+ <a href="#M000257">at</a>&nbsp;&nbsp;
127
+ <a href="#M000258">collect</a>&nbsp;&nbsp;
128
+ <a href="#M000259">collect!</a>&nbsp;&nbsp;
129
+ <a href="#M000260">compact</a>&nbsp;&nbsp;
130
+ <a href="#M000261">compact!</a>&nbsp;&nbsp;
131
+ <a href="#M000262">concat</a>&nbsp;&nbsp;
132
+ <a href="#M000263">count</a>&nbsp;&nbsp;
133
+ <a href="#M000264">delete</a>&nbsp;&nbsp;
134
+ <a href="#M000265">delete_at</a>&nbsp;&nbsp;
135
+ <a href="#M000266">delete_if</a>&nbsp;&nbsp;
136
+ <a href="#M000267">each</a>&nbsp;&nbsp;
137
+ <a href="#M000268">each_index</a>&nbsp;&nbsp;
138
+ <a href="#M000269">eql?</a>&nbsp;&nbsp;
139
+ <a href="#M000270">fill</a>&nbsp;&nbsp;
140
+ <a href="#M000271">first</a>&nbsp;&nbsp;
141
+ <a href="#M000272">flatten</a>&nbsp;&nbsp;
142
+ <a href="#M000273">flatten!</a>&nbsp;&nbsp;
143
+ <a href="#M000274">include?</a>&nbsp;&nbsp;
144
+ <a href="#M000275">join</a>&nbsp;&nbsp;
145
+ <a href="#M000276">last</a>&nbsp;&nbsp;
146
+ <a href="#M000277">map!</a>&nbsp;&nbsp;
147
+ <a href="#M000245">new</a>&nbsp;&nbsp;
148
+ <a href="#M000244">new_h</a>&nbsp;&nbsp;
149
+ <a href="#M000278">nitems</a>&nbsp;&nbsp;
150
+ <a href="#M000279">pack</a>&nbsp;&nbsp;
151
+ <a href="#M000280">pop</a>&nbsp;&nbsp;
152
+ <a href="#M000281">push</a>&nbsp;&nbsp;
153
+ <a href="#M000294">qsort</a>&nbsp;&nbsp;
154
+ <a href="#M000282">rassoc</a>&nbsp;&nbsp;
155
+ <a href="#M000283">reindex</a>&nbsp;&nbsp;
156
+ <a href="#M000284">reindex!</a>&nbsp;&nbsp;
157
+ <a href="#M000285">reject!</a>&nbsp;&nbsp;
158
+ <a href="#M000286">reverse</a>&nbsp;&nbsp;
159
+ <a href="#M000287">reverse!</a>&nbsp;&nbsp;
160
+ <a href="#M000288">reverse_each</a>&nbsp;&nbsp;
161
+ <a href="#M000289">rindex</a>&nbsp;&nbsp;
162
+ <a href="#M000290">shift</a>&nbsp;&nbsp;
163
+ <a href="#M000291">slice</a>&nbsp;&nbsp;
164
+ <a href="#M000292">slice!</a>&nbsp;&nbsp;
165
+ <a href="#M000293">sort</a>&nbsp;&nbsp;
166
+ <a href="#M000295">sort!</a>&nbsp;&nbsp;
167
+ <a href="#M000296">to_a</a>&nbsp;&nbsp;
168
+ <a href="#M000297">to_ary</a>&nbsp;&nbsp;
169
+ <a href="#M000298">to_h</a>&nbsp;&nbsp;
170
+ <a href="#M000299">to_s</a>&nbsp;&nbsp;
171
+ <a href="#M000300">uniq</a>&nbsp;&nbsp;
172
+ <a href="#M000301">uniq!</a>&nbsp;&nbsp;
173
+ <a href="#M000302">unshift</a>&nbsp;&nbsp;
174
+ <a href="#M000303">values_at</a>&nbsp;&nbsp;
175
+ <a href="#M000255">|</a>&nbsp;&nbsp;
176
+ </div>
177
+ </div>
178
+
179
+ </div>
180
+
181
+
182
+ <!-- if includes -->
183
+
184
+ <div id="section">
185
+
186
+
187
+
188
+ <div id="aliases-list">
189
+ <h3 class="section-bar">External Aliases</h3>
190
+
191
+ <div class="name-list">
192
+ <table summary="aliases">
193
+ <tr class="top-aligned-row context-row">
194
+ <td class="context-item-name">[]</td>
195
+ <td>-></td>
196
+ <td class="context-item-value">get</td>
197
+ </tr>
198
+ <tr class="top-aligned-row context-row">
199
+ <td class="context-item-name">[]=</td>
200
+ <td>-></td>
201
+ <td class="context-item-value">set</td>
202
+ </tr>
203
+ <tr class="top-aligned-row context-row">
204
+ <td class="context-item-name">delete</td>
205
+ <td>-></td>
206
+ <td class="context-item-value">qdelete</td>
207
+ </tr>
208
+ <tr class="top-aligned-row context-row">
209
+ <td class="context-item-name">delete_if</td>
210
+ <td>-></td>
211
+ <td class="context-item-value">qdelete_if</td>
212
+ </tr>
213
+ </table>
214
+ </div>
215
+ </div>
216
+
217
+
218
+
219
+
220
+
221
+ <!-- if method_list -->
222
+ <div id="methods">
223
+ <h3 class="section-bar">Public Class methods</h3>
224
+
225
+ <div id="method-M000243" class="method-detail">
226
+ <a name="M000243"></a>
227
+
228
+ <div class="method-heading">
229
+ <a href="#M000243" class="method-signature">
230
+ <span class="method-name">[]</span><span class="method-args">(*args)</span>
231
+ </a>
232
+ </div>
233
+
234
+ <div class="method-description">
235
+ <p><a class="source-toggle" href="#"
236
+ onclick="toggleCode('M000243-source');return false;">[Source]</a></p>
237
+ <div class="method-source-code" id="M000243-source">
238
+ <pre>
239
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 23</span>
240
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">HArray</span>.<span class="ruby-operator">[]</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
241
+ <span class="ruby-identifier">nha</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>
242
+ <span class="ruby-identifier">args</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">a</span><span class="ruby-operator">|</span> <span class="ruby-identifier">nha</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">nha</span>.<span class="ruby-identifier">length</span>,<span class="ruby-identifier">a</span>) }
243
+ <span class="ruby-identifier">nha</span>
244
+ <span class="ruby-keyword kw">end</span>
245
+ </pre>
246
+ </div>
247
+ </div>
248
+ </div>
249
+
250
+ <div id="method-M000245" class="method-detail">
251
+ <a name="M000245"></a>
252
+
253
+ <div class="method-heading">
254
+ <a href="#M000245" class="method-signature">
255
+ <span class="method-name">new</span><span class="method-args">(i=0,e=nil)</span>
256
+ </a>
257
+ </div>
258
+
259
+ <div class="method-description">
260
+ <p><a class="source-toggle" href="#"
261
+ onclick="toggleCode('M000245-source');return false;">[Source]</a></p>
262
+ <div class="method-source-code" id="M000245-source">
263
+ <pre>
264
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 35</span>
265
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">i</span>=<span class="ruby-value">0</span>,<span class="ruby-identifier">e</span>=<span class="ruby-keyword kw">nil</span>)
266
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&gt;</span> <span class="ruby-value">0</span>
267
+ <span class="ruby-identifier">i</span>.<span class="ruby-identifier">times</span> { <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>,<span class="ruby-identifier">e</span>) }
268
+ <span class="ruby-keyword kw">end</span>
269
+ <span class="ruby-keyword kw">end</span>
270
+ </pre>
271
+ </div>
272
+ </div>
273
+ </div>
274
+
275
+ <div id="method-M000244" class="method-detail">
276
+ <a name="M000244"></a>
277
+
278
+ <div class="method-heading">
279
+ <a href="#M000244" class="method-signature">
280
+ <span class="method-name">new_h</span><span class="method-args">(hsh)</span>
281
+ </a>
282
+ </div>
283
+
284
+ <div class="method-description">
285
+ <p><a class="source-toggle" href="#"
286
+ onclick="toggleCode('M000244-source');return false;">[Source]</a></p>
287
+ <div class="method-source-code" id="M000244-source">
288
+ <pre>
289
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 29</span>
290
+ <span class="ruby-keyword kw">def</span> <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new_h</span>(<span class="ruby-identifier">hsh</span>)
291
+ <span class="ruby-identifier">nha</span>=<span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>
292
+ <span class="ruby-identifier">nha</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">hsh</span>)
293
+ <span class="ruby-comment cmt">#nha.reindex!</span>
294
+ <span class="ruby-keyword kw">end</span>
295
+ </pre>
296
+ </div>
297
+ </div>
298
+ </div>
299
+
300
+ <h3 class="section-bar">Public Instance methods</h3>
301
+
302
+ <div id="method-M000246" class="method-detail">
303
+ <a name="M000246"></a>
304
+
305
+ <div class="method-heading">
306
+ <a href="#M000246" class="method-signature">
307
+ <span class="method-name">&amp;</span><span class="method-args">(ha)</span>
308
+ </a>
309
+ </div>
310
+
311
+ <div class="method-description">
312
+ <p><a class="source-toggle" href="#"
313
+ onclick="toggleCode('M000246-source');return false;">[Source]</a></p>
314
+ <div class="method-source-code" id="M000246-source">
315
+ <pre>
316
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 41</span>
317
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&amp;</span>(<span class="ruby-identifier">ha</span>)
318
+ <span class="ruby-identifier">nha</span>=<span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>
319
+ (<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
320
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ha</span>.<span class="ruby-identifier">has_value?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)) <span class="ruby-keyword kw">and</span> <span class="ruby-operator">!</span><span class="ruby-identifier">nha</span>.<span class="ruby-identifier">has_value?</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>))
321
+ <span class="ruby-identifier">nha</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">nha</span>.<span class="ruby-identifier">length</span>,<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>))
322
+ <span class="ruby-keyword kw">end</span>
323
+ <span class="ruby-keyword kw">end</span>
324
+ <span class="ruby-identifier">nha</span>
325
+ <span class="ruby-keyword kw">end</span>
326
+ </pre>
327
+ </div>
328
+ </div>
329
+ </div>
330
+
331
+ <div id="method-M000247" class="method-detail">
332
+ <a name="M000247"></a>
333
+
334
+ <div class="method-heading">
335
+ <a href="#M000247" class="method-signature">
336
+ <span class="method-name">*</span><span class="method-args">(j)</span>
337
+ </a>
338
+ </div>
339
+
340
+ <div class="method-description">
341
+ <p><a class="source-toggle" href="#"
342
+ onclick="toggleCode('M000247-source');return false;">[Source]</a></p>
343
+ <div class="method-source-code" id="M000247-source">
344
+ <pre>
345
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 51</span>
346
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">*</span>(<span class="ruby-identifier">j</span>)
347
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">j</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">String</span>)
348
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">join</span>(<span class="ruby-identifier">j</span>)
349
+ <span class="ruby-keyword kw">else</span>
350
+ <span class="ruby-identifier">nha</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>
351
+ <span class="ruby-identifier">j</span>.<span class="ruby-identifier">times</span> { (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">nha</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">nha</span>.<span class="ruby-identifier">length</span>,<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)) } }
352
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">nha</span>
353
+ <span class="ruby-keyword kw">end</span>
354
+ <span class="ruby-keyword kw">end</span>
355
+ </pre>
356
+ </div>
357
+ </div>
358
+ </div>
359
+
360
+ <div id="method-M000248" class="method-detail">
361
+ <a name="M000248"></a>
362
+
363
+ <div class="method-heading">
364
+ <a href="#M000248" class="method-signature">
365
+ <span class="method-name">+</span><span class="method-args">(ha)</span>
366
+ </a>
367
+ </div>
368
+
369
+ <div class="method-description">
370
+ <p><a class="source-toggle" href="#"
371
+ onclick="toggleCode('M000248-source');return false;">[Source]</a></p>
372
+ <div class="method-source-code" id="M000248-source">
373
+ <pre>
374
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 61</span>
375
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">+</span>(<span class="ruby-identifier">ha</span>)
376
+ <span class="ruby-identifier">nha</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
377
+ (<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">ha</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">nha</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">nha</span>.<span class="ruby-identifier">length</span>,<span class="ruby-identifier">ha</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)) }
378
+ <span class="ruby-identifier">nha</span>
379
+ <span class="ruby-keyword kw">end</span>
380
+ </pre>
381
+ </div>
382
+ </div>
383
+ </div>
384
+
385
+ <div id="method-M000249" class="method-detail">
386
+ <a name="M000249"></a>
387
+
388
+ <div class="method-heading">
389
+ <a href="#M000249" class="method-signature">
390
+ <span class="method-name">-</span><span class="method-args">(ha)</span>
391
+ </a>
392
+ </div>
393
+
394
+ <div class="method-description">
395
+ <p><a class="source-toggle" href="#"
396
+ onclick="toggleCode('M000249-source');return false;">[Source]</a></p>
397
+ <div class="method-source-code" id="M000249-source">
398
+ <pre>
399
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 67</span>
400
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">-</span>(<span class="ruby-identifier">ha</span>)
401
+ <span class="ruby-identifier">nha</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>
402
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">nha</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">ha</span>.<span class="ruby-identifier">has_value?</span>(<span class="ruby-identifier">v</span>) }
403
+ <span class="ruby-comment cmt">#ha.each { |v| nha &lt;&lt; i if !self.include?(v) }</span>
404
+ <span class="ruby-identifier">nha</span>
405
+ <span class="ruby-keyword kw">end</span>
406
+ </pre>
407
+ </div>
408
+ </div>
409
+ </div>
410
+
411
+ <div id="method-M000250" class="method-detail">
412
+ <a name="M000250"></a>
413
+
414
+ <div class="method-heading">
415
+ <a href="#M000250" class="method-signature">
416
+ <span class="method-name">&lt;&lt;</span><span class="method-args">(e)</span>
417
+ </a>
418
+ </div>
419
+
420
+ <div class="method-description">
421
+ <p><a class="source-toggle" href="#"
422
+ onclick="toggleCode('M000250-source');return false;">[Source]</a></p>
423
+ <div class="method-source-code" id="M000250-source">
424
+ <pre>
425
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 74</span>
426
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;&lt;</span>(<span class="ruby-identifier">e</span>)
427
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>,<span class="ruby-identifier">e</span>)
428
+ <span class="ruby-keyword kw">self</span>
429
+ <span class="ruby-keyword kw">end</span>
430
+ </pre>
431
+ </div>
432
+ </div>
433
+ </div>
434
+
435
+ <div id="method-M000251" class="method-detail">
436
+ <a name="M000251"></a>
437
+
438
+ <div class="method-heading">
439
+ <a href="#M000251" class="method-signature">
440
+ <span class="method-name">&lt;=&gt;</span><span class="method-args">(ha)</span>
441
+ </a>
442
+ </div>
443
+
444
+ <div class="method-description">
445
+ <p><a class="source-toggle" href="#"
446
+ onclick="toggleCode('M000251-source');return false;">[Source]</a></p>
447
+ <div class="method-source-code" id="M000251-source">
448
+ <pre>
449
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 79</span>
450
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">&lt;=&gt;</span>(<span class="ruby-identifier">ha</span>)
451
+ (<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
452
+ <span class="ruby-identifier">ieq</span> = (<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>) <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">ha</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>))
453
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">ieq</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">ieq</span> <span class="ruby-operator">!=</span> <span class="ruby-value">0</span>
454
+ <span class="ruby-keyword kw">end</span>
455
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">ha</span>.<span class="ruby-identifier">length</span>
456
+ <span class="ruby-keyword kw">end</span>
457
+ </pre>
458
+ </div>
459
+ </div>
460
+ </div>
461
+
462
+ <div id="method-M000252" class="method-detail">
463
+ <a name="M000252"></a>
464
+
465
+ <div class="method-heading">
466
+ <a href="#M000252" class="method-signature">
467
+ <span class="method-name">===</span><span class="method-args">(ha)</span>
468
+ </a>
469
+ </div>
470
+
471
+ <div class="method-description">
472
+ <p><a class="source-toggle" href="#"
473
+ onclick="toggleCode('M000252-source');return false;">[Source]</a></p>
474
+ <div class="method-source-code" id="M000252-source">
475
+ <pre>
476
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 87</span>
477
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">===</span>(<span class="ruby-identifier">ha</span>)
478
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-operator">==</span>(<span class="ruby-identifier">ha</span>)
479
+ <span class="ruby-keyword kw">end</span>
480
+ </pre>
481
+ </div>
482
+ </div>
483
+ </div>
484
+
485
+ <div id="method-M000253" class="method-detail">
486
+ <a name="M000253"></a>
487
+
488
+ <div class="method-heading">
489
+ <a href="#M000253" class="method-signature">
490
+ <span class="method-name">[]</span><span class="method-args">(i,l=nil)</span>
491
+ </a>
492
+ </div>
493
+
494
+ <div class="method-description">
495
+ <p><a class="source-toggle" href="#"
496
+ onclick="toggleCode('M000253-source');return false;">[Source]</a></p>
497
+ <div class="method-source-code" id="M000253-source">
498
+ <pre>
499
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 94</span>
500
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]</span>(<span class="ruby-identifier">i</span>,<span class="ruby-identifier">l</span>=<span class="ruby-keyword kw">nil</span>)
501
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">l</span>
502
+ <span class="ruby-identifier">i</span> = <span class="ruby-identifier">i</span><span class="ruby-operator">...</span><span class="ruby-identifier">i</span><span class="ruby-operator">+</span><span class="ruby-identifier">l</span>
503
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-operator">!</span> <span class="ruby-identifier">i</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Range</span>)
504
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">i</span>)
505
+ <span class="ruby-keyword kw">end</span>
506
+ <span class="ruby-identifier">nha</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>
507
+ <span class="ruby-identifier">i</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">j</span><span class="ruby-operator">|</span> <span class="ruby-identifier">nha</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">nha</span>.<span class="ruby-identifier">length</span>,<span class="ruby-identifier">get</span>(<span class="ruby-identifier">j</span>)) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">j</span>) }
508
+ <span class="ruby-identifier">nha</span>
509
+ <span class="ruby-keyword kw">end</span>
510
+ </pre>
511
+ </div>
512
+ </div>
513
+ </div>
514
+
515
+ <div id="method-M000254" class="method-detail">
516
+ <a name="M000254"></a>
517
+
518
+ <div class="method-heading">
519
+ <a href="#M000254" class="method-signature">
520
+ <span class="method-name">[]=</span><span class="method-args">(i,b,c=nil)</span>
521
+ </a>
522
+ </div>
523
+
524
+ <div class="method-description">
525
+ <p><a class="source-toggle" href="#"
526
+ onclick="toggleCode('M000254-source');return false;">[Source]</a></p>
527
+ <div class="method-source-code" id="M000254-source">
528
+ <pre>
529
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 106</span>
530
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">[]=</span>(<span class="ruby-identifier">i</span>,<span class="ruby-identifier">b</span>,<span class="ruby-identifier">c</span>=<span class="ruby-keyword kw">nil</span>)
531
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">c</span>
532
+ <span class="ruby-identifier">rng</span> = (<span class="ruby-constant">Integer</span>(<span class="ruby-identifier">i</span>)<span class="ruby-operator">..</span><span class="ruby-constant">Integer</span>(<span class="ruby-identifier">i</span><span class="ruby-operator">+</span><span class="ruby-identifier">b</span>))
533
+ <span class="ruby-identifier">b</span> = <span class="ruby-identifier">c</span>
534
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">i</span>.<span class="ruby-identifier">kind_of?</span> <span class="ruby-constant">Range</span>
535
+ <span class="ruby-identifier">rng</span> = <span class="ruby-identifier">i</span>
536
+ <span class="ruby-keyword kw">else</span>
537
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-constant">Integer</span>(<span class="ruby-identifier">i</span>),<span class="ruby-identifier">b</span>)
538
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">b</span>
539
+ <span class="ruby-keyword kw">end</span>
540
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">b</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">nil</span>
541
+ <span class="ruby-identifier">rng</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">qdelete</span>(<span class="ruby-identifier">i</span>) }
542
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">reindex!</span>
543
+ <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Array</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">b</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">HArray</span>)
544
+ <span class="ruby-identifier">j</span> = <span class="ruby-value">0</span>
545
+ <span class="ruby-identifier">rng</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>] = <span class="ruby-identifier">b</span>[<span class="ruby-identifier">j</span>]; <span class="ruby-identifier">j</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span> }
546
+ <span class="ruby-keyword kw">else</span>
547
+ <span class="ruby-identifier">rng</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">qdelete</span>(<span class="ruby-identifier">i</span>) }
548
+ <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">rng</span>.<span class="ruby-identifier">fist</span>] = <span class="ruby-identifier">b</span>
549
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">reindex!</span>
550
+ <span class="ruby-keyword kw">end</span>
551
+ <span class="ruby-keyword kw">end</span>
552
+ </pre>
553
+ </div>
554
+ </div>
555
+ </div>
556
+
557
+ <div id="method-M000256" class="method-detail">
558
+ <a name="M000256"></a>
559
+
560
+ <div class="method-heading">
561
+ <a href="#M000256" class="method-signature">
562
+ <span class="method-name">assoc</span><span class="method-args">(k)</span>
563
+ </a>
564
+ </div>
565
+
566
+ <div class="method-description">
567
+ <p><a class="source-toggle" href="#"
568
+ onclick="toggleCode('M000256-source');return false;">[Source]</a></p>
569
+ <div class="method-source-code" id="M000256-source">
570
+ <pre>
571
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 135</span>
572
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">assoc</span>(<span class="ruby-identifier">k</span>)
573
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)[<span class="ruby-value">0</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">k</span> }
574
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
575
+ <span class="ruby-keyword kw">end</span>
576
+ </pre>
577
+ </div>
578
+ </div>
579
+ </div>
580
+
581
+ <div id="method-M000257" class="method-detail">
582
+ <a name="M000257"></a>
583
+
584
+ <div class="method-heading">
585
+ <a href="#M000257" class="method-signature">
586
+ <span class="method-name">at</span><span class="method-args">(i)</span>
587
+ </a>
588
+ </div>
589
+
590
+ <div class="method-description">
591
+ <p><a class="source-toggle" href="#"
592
+ onclick="toggleCode('M000257-source');return false;">[Source]</a></p>
593
+ <div class="method-source-code" id="M000257-source">
594
+ <pre>
595
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 140</span>
596
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">at</span>(<span class="ruby-identifier">i</span>)
597
+ <span class="ruby-identifier">i</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&lt;=</span> <span class="ruby-value">-1</span>
598
+ <span class="ruby-identifier">get</span>(<span class="ruby-identifier">i</span>)
599
+ <span class="ruby-comment cmt">#return nil if i &lt; 0 or i &gt;= self.length</span>
600
+ <span class="ruby-comment cmt">#return self.fetch(i)</span>
601
+ <span class="ruby-keyword kw">end</span>
602
+ </pre>
603
+ </div>
604
+ </div>
605
+ </div>
606
+
607
+ <div id="method-M000258" class="method-detail">
608
+ <a name="M000258"></a>
609
+
610
+ <div class="method-heading">
611
+ <a href="#M000258" class="method-signature">
612
+ <span class="method-name">collect</span><span class="method-args">() {|self.fetch(i)| ...}</span>
613
+ </a>
614
+ </div>
615
+
616
+ <div class="method-description">
617
+ <p>
618
+ clear okay
619
+ </p>
620
+ <p><a class="source-toggle" href="#"
621
+ onclick="toggleCode('M000258-source');return false;">[Source]</a></p>
622
+ <div class="method-source-code" id="M000258-source">
623
+ <pre>
624
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 149</span>
625
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">collect</span>
626
+ <span class="ruby-identifier">nha</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>
627
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">nha</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)) }
628
+ <span class="ruby-identifier">nha</span>
629
+ <span class="ruby-keyword kw">end</span>
630
+ </pre>
631
+ </div>
632
+ </div>
633
+ </div>
634
+
635
+ <div id="method-M000259" class="method-detail">
636
+ <a name="M000259"></a>
637
+
638
+ <div class="method-heading">
639
+ <a href="#M000259" class="method-signature">
640
+ <span class="method-name">collect!</span><span class="method-args">() {|self.fetch(i)| ...}</span>
641
+ </a>
642
+ </div>
643
+
644
+ <div class="method-description">
645
+ <p><a class="source-toggle" href="#"
646
+ onclick="toggleCode('M000259-source');return false;">[Source]</a></p>
647
+ <div class="method-source-code" id="M000259-source">
648
+ <pre>
649
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 155</span>
650
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">collect!</span>
651
+ <span class="ruby-identifier">nha</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>
652
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">nha</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)) }
653
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">nha</span>)
654
+ <span class="ruby-keyword kw">end</span>
655
+ </pre>
656
+ </div>
657
+ </div>
658
+ </div>
659
+
660
+ <div id="method-M000260" class="method-detail">
661
+ <a name="M000260"></a>
662
+
663
+ <div class="method-heading">
664
+ <a href="#M000260" class="method-signature">
665
+ <span class="method-name">compact</span><span class="method-args">()</span>
666
+ </a>
667
+ </div>
668
+
669
+ <div class="method-description">
670
+ <p><a class="source-toggle" href="#"
671
+ onclick="toggleCode('M000260-source');return false;">[Source]</a></p>
672
+ <div class="method-source-code" id="M000260-source">
673
+ <pre>
674
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 161</span>
675
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compact</span>
676
+ <span class="ruby-identifier">nha</span>, <span class="ruby-identifier">j</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value">0</span>
677
+ (<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
678
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>) <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
679
+ <span class="ruby-identifier">nha</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">j</span>,<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>))
680
+ <span class="ruby-identifier">j</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span>
681
+ <span class="ruby-keyword kw">end</span>
682
+ <span class="ruby-keyword kw">end</span>
683
+ <span class="ruby-identifier">nha</span>
684
+ <span class="ruby-keyword kw">end</span>
685
+ </pre>
686
+ </div>
687
+ </div>
688
+ </div>
689
+
690
+ <div id="method-M000261" class="method-detail">
691
+ <a name="M000261"></a>
692
+
693
+ <div class="method-heading">
694
+ <a href="#M000261" class="method-signature">
695
+ <span class="method-name">compact!</span><span class="method-args">()</span>
696
+ </a>
697
+ </div>
698
+
699
+ <div class="method-description">
700
+ <p><a class="source-toggle" href="#"
701
+ onclick="toggleCode('M000261-source');return false;">[Source]</a></p>
702
+ <div class="method-source-code" id="M000261-source">
703
+ <pre>
704
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 172</span>
705
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">compact!</span>
706
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">has_value?</span>(<span class="ruby-keyword kw">nil</span>)
707
+ <span class="ruby-identifier">nha</span>, <span class="ruby-identifier">j</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value">0</span>
708
+ (<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
709
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>) <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span>
710
+ <span class="ruby-identifier">nha</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">j</span>,<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>))
711
+ <span class="ruby-identifier">j</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span>
712
+ <span class="ruby-keyword kw">end</span>
713
+ <span class="ruby-keyword kw">end</span>
714
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-identifier">nha</span>)
715
+ <span class="ruby-keyword kw">else</span>
716
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
717
+ <span class="ruby-keyword kw">end</span>
718
+ <span class="ruby-keyword kw">end</span>
719
+ </pre>
720
+ </div>
721
+ </div>
722
+ </div>
723
+
724
+ <div id="method-M000262" class="method-detail">
725
+ <a name="M000262"></a>
726
+
727
+ <div class="method-heading">
728
+ <a href="#M000262" class="method-signature">
729
+ <span class="method-name">concat</span><span class="method-args">(ha)</span>
730
+ </a>
731
+ </div>
732
+
733
+ <div class="method-description">
734
+ <p><a class="source-toggle" href="#"
735
+ onclick="toggleCode('M000262-source');return false;">[Source]</a></p>
736
+ <div class="method-source-code" id="M000262-source">
737
+ <pre>
738
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 187</span>
739
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">concat</span>(<span class="ruby-identifier">ha</span>)
740
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-identifier">ha</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>,<span class="ruby-identifier">ha</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)) }
741
+ <span class="ruby-keyword kw">self</span>
742
+ <span class="ruby-keyword kw">end</span>
743
+ </pre>
744
+ </div>
745
+ </div>
746
+ </div>
747
+
748
+ <div id="method-M000263" class="method-detail">
749
+ <a name="M000263"></a>
750
+
751
+ <div class="method-heading">
752
+ <a href="#M000263" class="method-signature">
753
+ <span class="method-name">count</span><span class="method-args">(e=nil) {|self.fetch(i)| ...}</span>
754
+ </a>
755
+ </div>
756
+
757
+ <div class="method-description">
758
+ <p><a class="source-toggle" href="#"
759
+ onclick="toggleCode('M000263-source');return false;">[Source]</a></p>
760
+ <div class="method-source-code" id="M000263-source">
761
+ <pre>
762
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 192</span>
763
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">count</span>(<span class="ruby-identifier">e</span>=<span class="ruby-keyword kw">nil</span>)
764
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
765
+ <span class="ruby-identifier">cnt</span> = <span class="ruby-value">0</span>
766
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">cnt</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)) }
767
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">cnt</span>
768
+ <span class="ruby-keyword kw">else</span>
769
+ <span class="ruby-identifier">cnt</span> = <span class="ruby-value">0</span>
770
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">cnt</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>) <span class="ruby-operator">==</span> <span class="ruby-identifier">e</span> }
771
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">cnt</span>
772
+ <span class="ruby-keyword kw">end</span>
773
+ <span class="ruby-keyword kw">end</span>
774
+ </pre>
775
+ </div>
776
+ </div>
777
+ </div>
778
+
779
+ <div id="method-M000264" class="method-detail">
780
+ <a name="M000264"></a>
781
+
782
+ <div class="method-heading">
783
+ <a href="#M000264" class="method-signature">
784
+ <span class="method-name">delete</span><span class="method-args">(e) {|if block_given?| ...}</span>
785
+ </a>
786
+ </div>
787
+
788
+ <div class="method-description">
789
+ <p><a class="source-toggle" href="#"
790
+ onclick="toggleCode('M000264-source');return false;">[Source]</a></p>
791
+ <div class="method-source-code" id="M000264-source">
792
+ <pre>
793
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 207</span>
794
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete</span>(<span class="ruby-identifier">e</span>)
795
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">has_value?</span>(<span class="ruby-identifier">e</span>)
796
+ <span class="ruby-identifier">qdelete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">v</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">e</span> }
797
+ <span class="ruby-identifier">reindex!</span>
798
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">e</span>
799
+ <span class="ruby-keyword kw">else</span>
800
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">yield</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
801
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
802
+ <span class="ruby-keyword kw">end</span>
803
+ <span class="ruby-keyword kw">end</span>
804
+ </pre>
805
+ </div>
806
+ </div>
807
+ </div>
808
+
809
+ <div id="method-M000265" class="method-detail">
810
+ <a name="M000265"></a>
811
+
812
+ <div class="method-heading">
813
+ <a href="#M000265" class="method-signature">
814
+ <span class="method-name">delete_at</span><span class="method-args">(i)</span>
815
+ </a>
816
+ </div>
817
+
818
+ <div class="method-description">
819
+ <p><a class="source-toggle" href="#"
820
+ onclick="toggleCode('M000265-source');return false;">[Source]</a></p>
821
+ <div class="method-source-code" id="M000265-source">
822
+ <pre>
823
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 218</span>
824
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">i</span>)
825
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">i</span>)
826
+ <span class="ruby-identifier">e</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)
827
+ <span class="ruby-identifier">qdelete</span>(<span class="ruby-identifier">i</span>)
828
+ <span class="ruby-identifier">reindex!</span>
829
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">e</span>
830
+ <span class="ruby-keyword kw">else</span>
831
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
832
+ <span class="ruby-keyword kw">end</span>
833
+ <span class="ruby-keyword kw">end</span>
834
+ </pre>
835
+ </div>
836
+ </div>
837
+ </div>
838
+
839
+ <div id="method-M000266" class="method-detail">
840
+ <a name="M000266"></a>
841
+
842
+ <div class="method-heading">
843
+ <a href="#M000266" class="method-signature">
844
+ <span class="method-name">delete_if</span><span class="method-args">() {|v| ...}</span>
845
+ </a>
846
+ </div>
847
+
848
+ <div class="method-description">
849
+ <p><a class="source-toggle" href="#"
850
+ onclick="toggleCode('M000266-source');return false;">[Source]</a></p>
851
+ <div class="method-source-code" id="M000266-source">
852
+ <pre>
853
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 232</span>
854
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">delete_if</span>
855
+ <span class="ruby-identifier">qdelete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">v</span>) }
856
+ <span class="ruby-identifier">reindex!</span>
857
+ <span class="ruby-keyword kw">end</span>
858
+ </pre>
859
+ </div>
860
+ </div>
861
+ </div>
862
+
863
+ <div id="method-M000267" class="method-detail">
864
+ <a name="M000267"></a>
865
+
866
+ <div class="method-heading">
867
+ <a href="#M000267" class="method-signature">
868
+ <span class="method-name">each</span><span class="method-args">() {|self.fetch(i)| ...}</span>
869
+ </a>
870
+ </div>
871
+
872
+ <div class="method-description">
873
+ <p><a class="source-toggle" href="#"
874
+ onclick="toggleCode('M000267-source');return false;">[Source]</a></p>
875
+ <div class="method-source-code" id="M000267-source">
876
+ <pre>
877
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 237</span>
878
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each</span>
879
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)) }
880
+ <span class="ruby-keyword kw">end</span>
881
+ </pre>
882
+ </div>
883
+ </div>
884
+ </div>
885
+
886
+ <div id="method-M000268" class="method-detail">
887
+ <a name="M000268"></a>
888
+
889
+ <div class="method-heading">
890
+ <a href="#M000268" class="method-signature">
891
+ <span class="method-name">each_index</span><span class="method-args">() {|i| ...}</span>
892
+ </a>
893
+ </div>
894
+
895
+ <div class="method-description">
896
+ <p><a class="source-toggle" href="#"
897
+ onclick="toggleCode('M000268-source');return false;">[Source]</a></p>
898
+ <div class="method-source-code" id="M000268-source">
899
+ <pre>
900
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 241</span>
901
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">each_index</span>
902
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">i</span>) }
903
+ <span class="ruby-keyword kw">end</span>
904
+ </pre>
905
+ </div>
906
+ </div>
907
+ </div>
908
+
909
+ <div id="method-M000269" class="method-detail">
910
+ <a name="M000269"></a>
911
+
912
+ <div class="method-heading">
913
+ <a href="#M000269" class="method-signature">
914
+ <span class="method-name">eql?</span><span class="method-args">(ha)</span>
915
+ </a>
916
+ </div>
917
+
918
+ <div class="method-description">
919
+ <p>
920
+ empty? okay as is
921
+ </p>
922
+ <p><a class="source-toggle" href="#"
923
+ onclick="toggleCode('M000269-source');return false;">[Source]</a></p>
924
+ <div class="method-source-code" id="M000269-source">
925
+ <pre>
926
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 247</span>
927
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">ha</span>)
928
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">ha</span>.<span class="ruby-identifier">length</span>
929
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">all?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>).<span class="ruby-identifier">eql?</span>(<span class="ruby-identifier">ha</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)) }
930
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">false</span>
931
+ <span class="ruby-keyword kw">end</span>
932
+ </pre>
933
+ </div>
934
+ </div>
935
+ </div>
936
+
937
+ <div id="method-M000270" class="method-detail">
938
+ <a name="M000270"></a>
939
+
940
+ <div class="method-heading">
941
+ <a href="#M000270" class="method-signature">
942
+ <span class="method-name">fill</span><span class="method-args">(f,s=nil,l=nil)</span>
943
+ </a>
944
+ </div>
945
+
946
+ <div class="method-description">
947
+ <p><a class="source-toggle" href="#"
948
+ onclick="toggleCode('M000270-source');return false;">[Source]</a></p>
949
+ <div class="method-source-code" id="M000270-source">
950
+ <pre>
951
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 253</span>
952
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">fill</span>(<span class="ruby-identifier">f</span>,<span class="ruby-identifier">s</span>=<span class="ruby-keyword kw">nil</span>,<span class="ruby-identifier">l</span>=<span class="ruby-keyword kw">nil</span>)
953
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Range</span>)
954
+ <span class="ruby-identifier">r</span> = <span class="ruby-identifier">s</span>
955
+ <span class="ruby-keyword kw">else</span>
956
+ <span class="ruby-identifier">s</span> = <span class="ruby-value">0</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">s</span>
957
+ <span class="ruby-identifier">l</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-identifier">s</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">l</span>
958
+ <span class="ruby-identifier">r</span> = <span class="ruby-identifier">s</span><span class="ruby-operator">...</span>(<span class="ruby-identifier">s</span><span class="ruby-operator">+</span><span class="ruby-identifier">l</span>)
959
+ <span class="ruby-keyword kw">end</span>
960
+ <span class="ruby-identifier">r</span>.<span class="ruby-identifier">each</span>{ <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">i</span>,<span class="ruby-identifier">f</span>) }
961
+ <span class="ruby-keyword kw">self</span>
962
+ <span class="ruby-keyword kw">end</span>
963
+ </pre>
964
+ </div>
965
+ </div>
966
+ </div>
967
+
968
+ <div id="method-M000271" class="method-detail">
969
+ <a name="M000271"></a>
970
+
971
+ <div class="method-heading">
972
+ <a href="#M000271" class="method-signature">
973
+ <span class="method-name">first</span><span class="method-args">()</span>
974
+ </a>
975
+ </div>
976
+
977
+ <div class="method-description">
978
+ <p><a class="source-toggle" href="#"
979
+ onclick="toggleCode('M000271-source');return false;">[Source]</a></p>
980
+ <div class="method-source-code" id="M000271-source">
981
+ <pre>
982
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 265</span>
983
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">first</span>
984
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">empty?</span>
985
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-value">0</span>)
986
+ <span class="ruby-keyword kw">end</span>
987
+ </pre>
988
+ </div>
989
+ </div>
990
+ </div>
991
+
992
+ <div id="method-M000272" class="method-detail">
993
+ <a name="M000272"></a>
994
+
995
+ <div class="method-heading">
996
+ <a href="#M000272" class="method-signature">
997
+ <span class="method-name">flatten</span><span class="method-args">()</span>
998
+ </a>
999
+ </div>
1000
+
1001
+ <div class="method-description">
1002
+ <p><a class="source-toggle" href="#"
1003
+ onclick="toggleCode('M000272-source');return false;">[Source]</a></p>
1004
+ <div class="method-source-code" id="M000272-source">
1005
+ <pre>
1006
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 270</span>
1007
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">flatten</span>
1008
+ <span class="ruby-identifier">nha</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>
1009
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
1010
+ <span class="ruby-identifier">sfi</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)
1011
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">sfi</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">HArray</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">sfi</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Array</span>)
1012
+ <span class="ruby-identifier">nha</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">sfi</span>.<span class="ruby-identifier">flatten</span>)
1013
+ <span class="ruby-keyword kw">else</span>
1014
+ <span class="ruby-identifier">nha</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">nha</span>.<span class="ruby-identifier">length</span>,<span class="ruby-identifier">sfi</span>)
1015
+ <span class="ruby-keyword kw">end</span>
1016
+ <span class="ruby-keyword kw">end</span>
1017
+ <span class="ruby-identifier">nha</span>
1018
+ <span class="ruby-keyword kw">end</span>
1019
+ </pre>
1020
+ </div>
1021
+ </div>
1022
+ </div>
1023
+
1024
+ <div id="method-M000273" class="method-detail">
1025
+ <a name="M000273"></a>
1026
+
1027
+ <div class="method-heading">
1028
+ <a href="#M000273" class="method-signature">
1029
+ <span class="method-name">flatten!</span><span class="method-args">()</span>
1030
+ </a>
1031
+ </div>
1032
+
1033
+ <div class="method-description">
1034
+ <p><a class="source-toggle" href="#"
1035
+ onclick="toggleCode('M000273-source');return false;">[Source]</a></p>
1036
+ <div class="method-source-code" id="M000273-source">
1037
+ <pre>
1038
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 283</span>
1039
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">flatten!</span>
1040
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">any?</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">HArray</span>) <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">e</span>.<span class="ruby-identifier">kind_of?</span>(<span class="ruby-constant">Array</span>) }
1041
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">flatten</span>)
1042
+ <span class="ruby-keyword kw">end</span>
1043
+ </pre>
1044
+ </div>
1045
+ </div>
1046
+ </div>
1047
+
1048
+ <div id="method-M000274" class="method-detail">
1049
+ <a name="M000274"></a>
1050
+
1051
+ <div class="method-heading">
1052
+ <a href="#M000274" class="method-signature">
1053
+ <span class="method-name">include?</span><span class="method-args">(v)</span>
1054
+ </a>
1055
+ </div>
1056
+
1057
+ <div class="method-description">
1058
+ <p><a class="source-toggle" href="#"
1059
+ onclick="toggleCode('M000274-source');return false;">[Source]</a></p>
1060
+ <div class="method-source-code" id="M000274-source">
1061
+ <pre>
1062
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 288</span>
1063
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">include?</span>(<span class="ruby-identifier">v</span>)
1064
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">has_value?</span>(<span class="ruby-identifier">v</span>)
1065
+ <span class="ruby-keyword kw">end</span>
1066
+ </pre>
1067
+ </div>
1068
+ </div>
1069
+ </div>
1070
+
1071
+ <div id="method-M000275" class="method-detail">
1072
+ <a name="M000275"></a>
1073
+
1074
+ <div class="method-heading">
1075
+ <a href="#M000275" class="method-signature">
1076
+ <span class="method-name">join</span><span class="method-args">(sep='')</span>
1077
+ </a>
1078
+ </div>
1079
+
1080
+ <div class="method-description">
1081
+ <p>
1082
+ index okay
1083
+ </p>
1084
+ <p><a class="source-toggle" href="#"
1085
+ onclick="toggleCode('M000275-source');return false;">[Source]</a></p>
1086
+ <div class="method-source-code" id="M000275-source">
1087
+ <pre>
1088
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 294</span>
1089
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">join</span>(<span class="ruby-identifier">sep</span>=<span class="ruby-value str">''</span>)
1090
+ <span class="ruby-identifier">s</span> = <span class="ruby-value str">''</span>
1091
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">s</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-node">&quot;#{self.fetch(i)}#{sep}&quot;</span> }
1092
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">s</span>.<span class="ruby-identifier">chomp</span>(<span class="ruby-identifier">sep</span>)
1093
+ <span class="ruby-keyword kw">end</span>
1094
+ </pre>
1095
+ </div>
1096
+ </div>
1097
+ </div>
1098
+
1099
+ <div id="method-M000276" class="method-detail">
1100
+ <a name="M000276"></a>
1101
+
1102
+ <div class="method-heading">
1103
+ <a href="#M000276" class="method-signature">
1104
+ <span class="method-name">last</span><span class="method-args">()</span>
1105
+ </a>
1106
+ </div>
1107
+
1108
+ <div class="method-description">
1109
+ <p><a class="source-toggle" href="#"
1110
+ onclick="toggleCode('M000276-source');return false;">[Source]</a></p>
1111
+ <div class="method-source-code" id="M000276-source">
1112
+ <pre>
1113
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 300</span>
1114
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">last</span>
1115
+ <span class="ruby-keyword kw">self</span>[<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>]
1116
+ <span class="ruby-keyword kw">end</span>
1117
+ </pre>
1118
+ </div>
1119
+ </div>
1120
+ </div>
1121
+
1122
+ <div id="method-M000277" class="method-detail">
1123
+ <a name="M000277"></a>
1124
+
1125
+ <div class="method-heading">
1126
+ <span class="method-name">map!</span><span class="method-args">()</span>
1127
+ </div>
1128
+
1129
+ <div class="method-description">
1130
+ <p>
1131
+ Alias for <a href="HArray.html#M000259">collect!</a>
1132
+ </p>
1133
+ </div>
1134
+ </div>
1135
+
1136
+ <div id="method-M000278" class="method-detail">
1137
+ <a name="M000278"></a>
1138
+
1139
+ <div class="method-heading">
1140
+ <a href="#M000278" class="method-signature">
1141
+ <span class="method-name">nitems</span><span class="method-args">()</span>
1142
+ </a>
1143
+ </div>
1144
+
1145
+ <div class="method-description">
1146
+ <p><a class="source-toggle" href="#"
1147
+ onclick="toggleCode('M000278-source');return false;">[Source]</a></p>
1148
+ <div class="method-source-code" id="M000278-source">
1149
+ <pre>
1150
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 308</span>
1151
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">nitems</span>
1152
+ <span class="ruby-identifier">cnt</span> = <span class="ruby-value">0</span>
1153
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">cnt</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>) <span class="ruby-operator">!=</span> <span class="ruby-keyword kw">nil</span> }
1154
+ <span class="ruby-identifier">cnt</span>
1155
+ <span class="ruby-keyword kw">end</span>
1156
+ </pre>
1157
+ </div>
1158
+ </div>
1159
+ </div>
1160
+
1161
+ <div id="method-M000279" class="method-detail">
1162
+ <a name="M000279"></a>
1163
+
1164
+ <div class="method-heading">
1165
+ <a href="#M000279" class="method-signature">
1166
+ <span class="method-name">pack</span><span class="method-args">(*args)</span>
1167
+ </a>
1168
+ </div>
1169
+
1170
+ <div class="method-description">
1171
+ <p><a class="source-toggle" href="#"
1172
+ onclick="toggleCode('M000279-source');return false;">[Source]</a></p>
1173
+ <div class="method-source-code" id="M000279-source">
1174
+ <pre>
1175
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 314</span>
1176
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pack</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
1177
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">to_a</span>.<span class="ruby-identifier">pack</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
1178
+ <span class="ruby-keyword kw">end</span>
1179
+ </pre>
1180
+ </div>
1181
+ </div>
1182
+ </div>
1183
+
1184
+ <div id="method-M000280" class="method-detail">
1185
+ <a name="M000280"></a>
1186
+
1187
+ <div class="method-heading">
1188
+ <a href="#M000280" class="method-signature">
1189
+ <span class="method-name">pop</span><span class="method-args">()</span>
1190
+ </a>
1191
+ </div>
1192
+
1193
+ <div class="method-description">
1194
+ <p><a class="source-toggle" href="#"
1195
+ onclick="toggleCode('M000280-source');return false;">[Source]</a></p>
1196
+ <div class="method-source-code" id="M000280-source">
1197
+ <pre>
1198
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 318</span>
1199
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">pop</span>
1200
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)
1201
+ <span class="ruby-keyword kw">end</span>
1202
+ </pre>
1203
+ </div>
1204
+ </div>
1205
+ </div>
1206
+
1207
+ <div id="method-M000281" class="method-detail">
1208
+ <a name="M000281"></a>
1209
+
1210
+ <div class="method-heading">
1211
+ <a href="#M000281" class="method-signature">
1212
+ <span class="method-name">push</span><span class="method-args">(*e)</span>
1213
+ </a>
1214
+ </div>
1215
+
1216
+ <div class="method-description">
1217
+ <p><a class="source-toggle" href="#"
1218
+ onclick="toggleCode('M000281-source');return false;">[Source]</a></p>
1219
+ <div class="method-source-code" id="M000281-source">
1220
+ <pre>
1221
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 322</span>
1222
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">push</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">e</span>)
1223
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">concat</span>(<span class="ruby-identifier">e</span>)
1224
+ <span class="ruby-keyword kw">end</span>
1225
+ </pre>
1226
+ </div>
1227
+ </div>
1228
+ </div>
1229
+
1230
+ <div id="method-M000294" class="method-detail">
1231
+ <a name="M000294"></a>
1232
+
1233
+ <div class="method-heading">
1234
+ <a href="#M000294" class="method-signature">
1235
+ <span class="method-name">qsort</span><span class="method-args">(ha, l, r)</span>
1236
+ </a>
1237
+ </div>
1238
+
1239
+ <div class="method-description">
1240
+ <p><a class="source-toggle" href="#"
1241
+ onclick="toggleCode('M000294-source');return false;">[Source]</a></p>
1242
+ <div class="method-source-code" id="M000294-source">
1243
+ <pre>
1244
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 421</span>
1245
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">qsort</span>(<span class="ruby-identifier">ha</span>, <span class="ruby-identifier">l</span>, <span class="ruby-identifier">r</span>)
1246
+ <span class="ruby-identifier">l_hold</span> = <span class="ruby-identifier">l</span>
1247
+ <span class="ruby-identifier">r_hold</span> = <span class="ruby-identifier">r</span>
1248
+ <span class="ruby-identifier">pivot</span> = <span class="ruby-identifier">ha</span>[<span class="ruby-identifier">l</span>]
1249
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">l</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">r</span>
1250
+ <span class="ruby-identifier">r</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">ha</span>[<span class="ruby-identifier">r</span>] <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">pivot</span>) <span class="ruby-operator">&gt;=</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">l</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">r</span>
1251
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">l</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">r</span>
1252
+ <span class="ruby-identifier">ha</span>[<span class="ruby-identifier">l</span>] = <span class="ruby-identifier">ha</span>[<span class="ruby-identifier">r</span>]
1253
+ <span class="ruby-identifier">l</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span>
1254
+ <span class="ruby-keyword kw">end</span>
1255
+ <span class="ruby-identifier">l</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">while</span> (<span class="ruby-identifier">ha</span>[<span class="ruby-identifier">l</span>] <span class="ruby-operator">&lt;=&gt;</span> <span class="ruby-identifier">pivot</span>) <span class="ruby-operator">&lt;=</span> <span class="ruby-value">0</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">l</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">r</span>
1256
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">l</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">r</span>
1257
+ <span class="ruby-identifier">ha</span>[<span class="ruby-identifier">r</span>] = <span class="ruby-identifier">ha</span>[<span class="ruby-identifier">l</span>]
1258
+ <span class="ruby-identifier">r</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
1259
+ <span class="ruby-keyword kw">end</span>
1260
+ <span class="ruby-keyword kw">end</span>
1261
+ <span class="ruby-identifier">ha</span>[<span class="ruby-identifier">l</span>] = <span class="ruby-identifier">pivot</span>
1262
+ <span class="ruby-identifier">pivot</span> = <span class="ruby-identifier">l</span>
1263
+ <span class="ruby-identifier">l</span> = <span class="ruby-identifier">l_hold</span>
1264
+ <span class="ruby-identifier">r</span> = <span class="ruby-identifier">r_hold</span>
1265
+ <span class="ruby-identifier">qsort</span>(<span class="ruby-identifier">ha</span>,<span class="ruby-identifier">l</span>,<span class="ruby-identifier">pivot</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">l</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">pivot</span>
1266
+ <span class="ruby-identifier">qsort</span>(<span class="ruby-identifier">ha</span>,<span class="ruby-identifier">pivot</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>,<span class="ruby-identifier">r</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">r</span> <span class="ruby-operator">&gt;</span> <span class="ruby-identifier">pivot</span>
1267
+ <span class="ruby-identifier">ha</span>
1268
+ <span class="ruby-keyword kw">end</span>
1269
+ </pre>
1270
+ </div>
1271
+ </div>
1272
+ </div>
1273
+
1274
+ <div id="method-M000282" class="method-detail">
1275
+ <a name="M000282"></a>
1276
+
1277
+ <div class="method-heading">
1278
+ <a href="#M000282" class="method-signature">
1279
+ <span class="method-name">rassoc</span><span class="method-args">(k)</span>
1280
+ </a>
1281
+ </div>
1282
+
1283
+ <div class="method-description">
1284
+ <p><a class="source-toggle" href="#"
1285
+ onclick="toggleCode('M000282-source');return false;">[Source]</a></p>
1286
+ <div class="method-source-code" id="M000282-source">
1287
+ <pre>
1288
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 326</span>
1289
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rassoc</span>(<span class="ruby-identifier">k</span>)
1290
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)[<span class="ruby-value">1</span>] <span class="ruby-operator">==</span> <span class="ruby-identifier">k</span> }
1291
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
1292
+ <span class="ruby-keyword kw">end</span>
1293
+ </pre>
1294
+ </div>
1295
+ </div>
1296
+ </div>
1297
+
1298
+ <div id="method-M000283" class="method-detail">
1299
+ <a name="M000283"></a>
1300
+
1301
+ <div class="method-heading">
1302
+ <a href="#M000283" class="method-signature">
1303
+ <span class="method-name">reindex</span><span class="method-args">()</span>
1304
+ </a>
1305
+ </div>
1306
+
1307
+ <div class="method-description">
1308
+ <p><a class="source-toggle" href="#"
1309
+ onclick="toggleCode('M000283-source');return false;">[Source]</a></p>
1310
+ <div class="method-source-code" id="M000283-source">
1311
+ <pre>
1312
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 331</span>
1313
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reindex</span>
1314
+ <span class="ruby-identifier">nha</span>, <span class="ruby-identifier">j</span>, <span class="ruby-identifier">k</span>, <span class="ruby-identifier">tl</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>, <span class="ruby-value">0</span>, <span class="ruby-value">0</span>, <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>
1315
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">k</span> <span class="ruby-operator">&lt;</span> <span class="ruby-identifier">tl</span>
1316
+ <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">has_key?</span>(<span class="ruby-identifier">j</span>)
1317
+ <span class="ruby-identifier">nha</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">k</span>,<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">j</span>))
1318
+ <span class="ruby-identifier">j</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span>; <span class="ruby-identifier">k</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span>
1319
+ <span class="ruby-keyword kw">else</span>
1320
+ <span class="ruby-identifier">j</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span>
1321
+ <span class="ruby-keyword kw">end</span>
1322
+ <span class="ruby-keyword kw">end</span>
1323
+ <span class="ruby-identifier">nha</span>
1324
+ <span class="ruby-keyword kw">end</span>
1325
+ </pre>
1326
+ </div>
1327
+ </div>
1328
+ </div>
1329
+
1330
+ <div id="method-M000284" class="method-detail">
1331
+ <a name="M000284"></a>
1332
+
1333
+ <div class="method-heading">
1334
+ <a href="#M000284" class="method-signature">
1335
+ <span class="method-name">reindex!</span><span class="method-args">()</span>
1336
+ </a>
1337
+ </div>
1338
+
1339
+ <div class="method-description">
1340
+ <p><a class="source-toggle" href="#"
1341
+ onclick="toggleCode('M000284-source');return false;">[Source]</a></p>
1342
+ <div class="method-source-code" id="M000284-source">
1343
+ <pre>
1344
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 344</span>
1345
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reindex!</span>
1346
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">replace</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">reindex</span>)
1347
+ <span class="ruby-keyword kw">end</span>
1348
+ </pre>
1349
+ </div>
1350
+ </div>
1351
+ </div>
1352
+
1353
+ <div id="method-M000285" class="method-detail">
1354
+ <a name="M000285"></a>
1355
+
1356
+ <div class="method-heading">
1357
+ <a href="#M000285" class="method-signature">
1358
+ <span class="method-name">reject!</span><span class="method-args">() {|v| ...}</span>
1359
+ </a>
1360
+ </div>
1361
+
1362
+ <div class="method-description">
1363
+ <p><a class="source-toggle" href="#"
1364
+ onclick="toggleCode('M000285-source');return false;">[Source]</a></p>
1365
+ <div class="method-source-code" id="M000285-source">
1366
+ <pre>
1367
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 348</span>
1368
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reject!</span>
1369
+ <span class="ruby-identifier">chg</span>=<span class="ruby-keyword kw">nil</span>
1370
+ <span class="ruby-identifier">qdelete_if</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">r</span>=<span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">v</span>); <span class="ruby-identifier">chg</span>=<span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">r</span>; <span class="ruby-identifier">r</span> }
1371
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">chg</span>
1372
+ <span class="ruby-identifier">reindex!</span>
1373
+ <span class="ruby-keyword kw">end</span>
1374
+ </pre>
1375
+ </div>
1376
+ </div>
1377
+ </div>
1378
+
1379
+ <div id="method-M000286" class="method-detail">
1380
+ <a name="M000286"></a>
1381
+
1382
+ <div class="method-heading">
1383
+ <a href="#M000286" class="method-signature">
1384
+ <span class="method-name">reverse</span><span class="method-args">()</span>
1385
+ </a>
1386
+ </div>
1387
+
1388
+ <div class="method-description">
1389
+ <p>
1390
+ def replace(ha)
1391
+ </p>
1392
+ <pre>
1393
+ if ha.length &lt; self.length
1394
+ (ha.length..self.length-1).each { |i| self.delete(i) }
1395
+ (0..ha.length-1).each { |i| self.set(i,ha[i]) }
1396
+ end
1397
+ </pre>
1398
+ <p>
1399
+ end
1400
+ </p>
1401
+ <p><a class="source-toggle" href="#"
1402
+ onclick="toggleCode('M000286-source');return false;">[Source]</a></p>
1403
+ <div class="method-source-code" id="M000286-source">
1404
+ <pre>
1405
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 362</span>
1406
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reverse</span>
1407
+ <span class="ruby-identifier">nha</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>
1408
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">nha</span>.<span class="ruby-identifier">set</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span><span class="ruby-operator">-</span><span class="ruby-identifier">i</span>,<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)) }
1409
+ <span class="ruby-identifier">nha</span>
1410
+ <span class="ruby-keyword kw">end</span>
1411
+ </pre>
1412
+ </div>
1413
+ </div>
1414
+ </div>
1415
+
1416
+ <div id="method-M000287" class="method-detail">
1417
+ <a name="M000287"></a>
1418
+
1419
+ <div class="method-heading">
1420
+ <a href="#M000287" class="method-signature">
1421
+ <span class="method-name">reverse!</span><span class="method-args">()</span>
1422
+ </a>
1423
+ </div>
1424
+
1425
+ <div class="method-description">
1426
+ <p><a class="source-toggle" href="#"
1427
+ onclick="toggleCode('M000287-source');return false;">[Source]</a></p>
1428
+ <div class="method-source-code" id="M000287-source">
1429
+ <pre>
1430
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 368</span>
1431
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reverse!</span>
1432
+ (<span class="ruby-value">0</span><span class="ruby-operator">...</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">/</span><span class="ruby-value">2</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
1433
+ <span class="ruby-identifier">ri</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span><span class="ruby-operator">-</span><span class="ruby-identifier">i</span>
1434
+ <span class="ruby-identifier">tmp</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">ri</span>)
1435
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">ri</span>,<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>))
1436
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">i</span>,<span class="ruby-identifier">tmp</span>)
1437
+ <span class="ruby-keyword kw">end</span>
1438
+ <span class="ruby-keyword kw">self</span>
1439
+ <span class="ruby-keyword kw">end</span>
1440
+ </pre>
1441
+ </div>
1442
+ </div>
1443
+ </div>
1444
+
1445
+ <div id="method-M000288" class="method-detail">
1446
+ <a name="M000288"></a>
1447
+
1448
+ <div class="method-heading">
1449
+ <a href="#M000288" class="method-signature">
1450
+ <span class="method-name">reverse_each</span><span class="method-args">() {|self.fetch(i)| ...}</span>
1451
+ </a>
1452
+ </div>
1453
+
1454
+ <div class="method-description">
1455
+ <p><a class="source-toggle" href="#"
1456
+ onclick="toggleCode('M000288-source');return false;">[Source]</a></p>
1457
+ <div class="method-source-code" id="M000288-source">
1458
+ <pre>
1459
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 378</span>
1460
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">reverse_each</span>
1461
+ <span class="ruby-identifier">i</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
1462
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">0</span>
1463
+ <span class="ruby-keyword kw">yield</span>(<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>))
1464
+ <span class="ruby-identifier">i</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
1465
+ <span class="ruby-keyword kw">end</span>
1466
+ <span class="ruby-keyword kw">end</span>
1467
+ </pre>
1468
+ </div>
1469
+ </div>
1470
+ </div>
1471
+
1472
+ <div id="method-M000289" class="method-detail">
1473
+ <a name="M000289"></a>
1474
+
1475
+ <div class="method-heading">
1476
+ <a href="#M000289" class="method-signature">
1477
+ <span class="method-name">rindex</span><span class="method-args">(e)</span>
1478
+ </a>
1479
+ </div>
1480
+
1481
+ <div class="method-description">
1482
+ <p><a class="source-toggle" href="#"
1483
+ onclick="toggleCode('M000289-source');return false;">[Source]</a></p>
1484
+ <div class="method-source-code" id="M000289-source">
1485
+ <pre>
1486
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 386</span>
1487
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">rindex</span>(<span class="ruby-identifier">e</span>)
1488
+ <span class="ruby-identifier">i</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
1489
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">0</span>
1490
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>) <span class="ruby-operator">==</span> <span class="ruby-identifier">e</span>
1491
+ <span class="ruby-identifier">i</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
1492
+ <span class="ruby-keyword kw">end</span>
1493
+ <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span>
1494
+ <span class="ruby-keyword kw">end</span>
1495
+ </pre>
1496
+ </div>
1497
+ </div>
1498
+ </div>
1499
+
1500
+ <div id="method-M000290" class="method-detail">
1501
+ <a name="M000290"></a>
1502
+
1503
+ <div class="method-heading">
1504
+ <a href="#M000290" class="method-signature">
1505
+ <span class="method-name">shift</span><span class="method-args">()</span>
1506
+ </a>
1507
+ </div>
1508
+
1509
+ <div class="method-description">
1510
+ <p><a class="source-toggle" href="#"
1511
+ onclick="toggleCode('M000290-source');return false;">[Source]</a></p>
1512
+ <div class="method-source-code" id="M000290-source">
1513
+ <pre>
1514
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 395</span>
1515
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">shift</span>
1516
+ <span class="ruby-identifier">e1</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span>]
1517
+ <span class="ruby-identifier">tl</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
1518
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-identifier">tl</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">i</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>,<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>)) }
1519
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">delete_at</span>(<span class="ruby-identifier">tl</span>)
1520
+ <span class="ruby-identifier">e1</span>
1521
+ <span class="ruby-keyword kw">end</span>
1522
+ </pre>
1523
+ </div>
1524
+ </div>
1525
+ </div>
1526
+
1527
+ <div id="method-M000291" class="method-detail">
1528
+ <a name="M000291"></a>
1529
+
1530
+ <div class="method-heading">
1531
+ <a href="#M000291" class="method-signature">
1532
+ <span class="method-name">slice</span><span class="method-args">(*args)</span>
1533
+ </a>
1534
+ </div>
1535
+
1536
+ <div class="method-description">
1537
+ <p>
1538
+ size okay
1539
+ </p>
1540
+ <p><a class="source-toggle" href="#"
1541
+ onclick="toggleCode('M000291-source');return false;">[Source]</a></p>
1542
+ <div class="method-source-code" id="M000291-source">
1543
+ <pre>
1544
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 405</span>
1545
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">slice</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
1546
+ <span class="ruby-keyword kw">self</span>[<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>]
1547
+ <span class="ruby-keyword kw">end</span>
1548
+ </pre>
1549
+ </div>
1550
+ </div>
1551
+ </div>
1552
+
1553
+ <div id="method-M000292" class="method-detail">
1554
+ <a name="M000292"></a>
1555
+
1556
+ <div class="method-heading">
1557
+ <a href="#M000292" class="method-signature">
1558
+ <span class="method-name">slice!</span><span class="method-args">(*args)</span>
1559
+ </a>
1560
+ </div>
1561
+
1562
+ <div class="method-description">
1563
+ <p><a class="source-toggle" href="#"
1564
+ onclick="toggleCode('M000292-source');return false;">[Source]</a></p>
1565
+ <div class="method-source-code" id="M000292-source">
1566
+ <pre>
1567
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 409</span>
1568
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">slice!</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
1569
+ <span class="ruby-identifier">result</span> = <span class="ruby-keyword kw">self</span>[<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>]
1570
+ <span class="ruby-keyword kw">self</span>[<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>] = <span class="ruby-keyword kw">nil</span>
1571
+ <span class="ruby-identifier">result</span>
1572
+ <span class="ruby-keyword kw">end</span>
1573
+ </pre>
1574
+ </div>
1575
+ </div>
1576
+ </div>
1577
+
1578
+ <div id="method-M000293" class="method-detail">
1579
+ <a name="M000293"></a>
1580
+
1581
+ <div class="method-heading">
1582
+ <a href="#M000293" class="method-signature">
1583
+ <span class="method-name">sort</span><span class="method-args">()</span>
1584
+ </a>
1585
+ </div>
1586
+
1587
+ <div class="method-description">
1588
+ <p><a class="source-toggle" href="#"
1589
+ onclick="toggleCode('M000293-source');return false;">[Source]</a></p>
1590
+ <div class="method-source-code" id="M000293-source">
1591
+ <pre>
1592
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 415</span>
1593
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sort</span>
1594
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;HArray does not currently support sorting with blocks&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
1595
+ <span class="ruby-identifier">nha</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
1596
+ <span class="ruby-identifier">qsort</span>(<span class="ruby-identifier">nha</span>,<span class="ruby-value">0</span>,<span class="ruby-identifier">nha</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)
1597
+ <span class="ruby-keyword kw">end</span>
1598
+ </pre>
1599
+ </div>
1600
+ </div>
1601
+ </div>
1602
+
1603
+ <div id="method-M000295" class="method-detail">
1604
+ <a name="M000295"></a>
1605
+
1606
+ <div class="method-heading">
1607
+ <a href="#M000295" class="method-signature">
1608
+ <span class="method-name">sort!</span><span class="method-args">()</span>
1609
+ </a>
1610
+ </div>
1611
+
1612
+ <div class="method-description">
1613
+ <p><a class="source-toggle" href="#"
1614
+ onclick="toggleCode('M000295-source');return false;">[Source]</a></p>
1615
+ <div class="method-source-code" id="M000295-source">
1616
+ <pre>
1617
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 446</span>
1618
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">sort!</span>
1619
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;HArray does not currently support sorting with blocks&quot;</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
1620
+ <span class="ruby-identifier">qsort</span>(<span class="ruby-keyword kw">self</span>,<span class="ruby-value">0</span>,<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>)
1621
+ <span class="ruby-keyword kw">end</span>
1622
+ </pre>
1623
+ </div>
1624
+ </div>
1625
+ </div>
1626
+
1627
+ <div id="method-M000296" class="method-detail">
1628
+ <a name="M000296"></a>
1629
+
1630
+ <div class="method-heading">
1631
+ <a href="#M000296" class="method-signature">
1632
+ <span class="method-name">to_a</span><span class="method-args">()</span>
1633
+ </a>
1634
+ </div>
1635
+
1636
+ <div class="method-description">
1637
+ <p><a class="source-toggle" href="#"
1638
+ onclick="toggleCode('M000296-source');return false;">[Source]</a></p>
1639
+ <div class="method-source-code" id="M000296-source">
1640
+ <pre>
1641
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 451</span>
1642
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_a</span>
1643
+ <span class="ruby-identifier">a</span> = []
1644
+ (<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">a</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>) }
1645
+ <span class="ruby-identifier">a</span>
1646
+ <span class="ruby-keyword kw">end</span>
1647
+ </pre>
1648
+ </div>
1649
+ </div>
1650
+ </div>
1651
+
1652
+ <div id="method-M000297" class="method-detail">
1653
+ <a name="M000297"></a>
1654
+
1655
+ <div class="method-heading">
1656
+ <a href="#M000297" class="method-signature">
1657
+ <span class="method-name">to_ary</span><span class="method-args">()</span>
1658
+ </a>
1659
+ </div>
1660
+
1661
+ <div class="method-description">
1662
+ <p><a class="source-toggle" href="#"
1663
+ onclick="toggleCode('M000297-source');return false;">[Source]</a></p>
1664
+ <div class="method-source-code" id="M000297-source">
1665
+ <pre>
1666
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 457</span>
1667
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_ary</span>
1668
+ <span class="ruby-keyword kw">self</span>
1669
+ <span class="ruby-keyword kw">end</span>
1670
+ </pre>
1671
+ </div>
1672
+ </div>
1673
+ </div>
1674
+
1675
+ <div id="method-M000298" class="method-detail">
1676
+ <a name="M000298"></a>
1677
+
1678
+ <div class="method-heading">
1679
+ <a href="#M000298" class="method-signature">
1680
+ <span class="method-name">to_h</span><span class="method-args">()</span>
1681
+ </a>
1682
+ </div>
1683
+
1684
+ <div class="method-description">
1685
+ <p><a class="source-toggle" href="#"
1686
+ onclick="toggleCode('M000298-source');return false;">[Source]</a></p>
1687
+ <div class="method-source-code" id="M000298-source">
1688
+ <pre>
1689
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 461</span>
1690
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_h</span>
1691
+ <span class="ruby-identifier">h</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
1692
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">k</span>,<span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">h</span>[<span class="ruby-identifier">k</span>] = <span class="ruby-identifier">v</span> }
1693
+ <span class="ruby-identifier">h</span>
1694
+ <span class="ruby-keyword kw">end</span>
1695
+ </pre>
1696
+ </div>
1697
+ </div>
1698
+ </div>
1699
+
1700
+ <div id="method-M000299" class="method-detail">
1701
+ <a name="M000299"></a>
1702
+
1703
+ <div class="method-heading">
1704
+ <a href="#M000299" class="method-signature">
1705
+ <span class="method-name">to_s</span><span class="method-args">()</span>
1706
+ </a>
1707
+ </div>
1708
+
1709
+ <div class="method-description">
1710
+ <p><a class="source-toggle" href="#"
1711
+ onclick="toggleCode('M000299-source');return false;">[Source]</a></p>
1712
+ <div class="method-source-code" id="M000299-source">
1713
+ <pre>
1714
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 467</span>
1715
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_s</span>
1716
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">join</span>
1717
+ <span class="ruby-keyword kw">end</span>
1718
+ </pre>
1719
+ </div>
1720
+ </div>
1721
+ </div>
1722
+
1723
+ <div id="method-M000300" class="method-detail">
1724
+ <a name="M000300"></a>
1725
+
1726
+ <div class="method-heading">
1727
+ <a href="#M000300" class="method-signature">
1728
+ <span class="method-name">uniq</span><span class="method-args">()</span>
1729
+ </a>
1730
+ </div>
1731
+
1732
+ <div class="method-description">
1733
+ <p><a class="source-toggle" href="#"
1734
+ onclick="toggleCode('M000300-source');return false;">[Source]</a></p>
1735
+ <div class="method-source-code" id="M000300-source">
1736
+ <pre>
1737
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 471</span>
1738
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uniq</span>
1739
+ <span class="ruby-identifier">nha</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>
1740
+ (<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
1741
+ <span class="ruby-identifier">nha</span>[<span class="ruby-identifier">nha</span>.<span class="ruby-identifier">length</span>] = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>] <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">nha</span>.<span class="ruby-identifier">has_value?</span>(<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>])
1742
+ <span class="ruby-keyword kw">end</span>
1743
+ <span class="ruby-identifier">nha</span>
1744
+ <span class="ruby-keyword kw">end</span>
1745
+ </pre>
1746
+ </div>
1747
+ </div>
1748
+ </div>
1749
+
1750
+ <div id="method-M000301" class="method-detail">
1751
+ <a name="M000301"></a>
1752
+
1753
+ <div class="method-heading">
1754
+ <a href="#M000301" class="method-signature">
1755
+ <span class="method-name">uniq!</span><span class="method-args">()</span>
1756
+ </a>
1757
+ </div>
1758
+
1759
+ <div class="method-description">
1760
+ <p><a class="source-toggle" href="#"
1761
+ onclick="toggleCode('M000301-source');return false;">[Source]</a></p>
1762
+ <div class="method-source-code" id="M000301-source">
1763
+ <pre>
1764
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 479</span>
1765
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">uniq!</span>
1766
+ <span class="ruby-identifier">j</span> = <span class="ruby-value">0</span>
1767
+ (<span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>).<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span>
1768
+ <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">self</span>[<span class="ruby-value">0</span><span class="ruby-operator">..</span><span class="ruby-identifier">j</span>].<span class="ruby-identifier">has_value?</span>(<span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>])
1769
+ <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">j</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>] = <span class="ruby-keyword kw">self</span>[<span class="ruby-identifier">i</span>]
1770
+ <span class="ruby-identifier">j</span><span class="ruby-operator">+=</span><span class="ruby-value">1</span>
1771
+ <span class="ruby-keyword kw">end</span>
1772
+ <span class="ruby-keyword kw">end</span>
1773
+ (<span class="ruby-identifier">j</span><span class="ruby-operator">+</span><span class="ruby-value">1</span><span class="ruby-operator">..</span><span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>).<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">qdelete</span>(<span class="ruby-identifier">i</span>) }
1774
+ <span class="ruby-keyword kw">end</span>
1775
+ </pre>
1776
+ </div>
1777
+ </div>
1778
+ </div>
1779
+
1780
+ <div id="method-M000302" class="method-detail">
1781
+ <a name="M000302"></a>
1782
+
1783
+ <div class="method-heading">
1784
+ <a href="#M000302" class="method-signature">
1785
+ <span class="method-name">unshift</span><span class="method-args">(e)</span>
1786
+ </a>
1787
+ </div>
1788
+
1789
+ <div class="method-description">
1790
+ <p><a class="source-toggle" href="#"
1791
+ onclick="toggleCode('M000302-source');return false;">[Source]</a></p>
1792
+ <div class="method-source-code" id="M000302-source">
1793
+ <pre>
1794
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 490</span>
1795
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unshift</span>(<span class="ruby-identifier">e</span>)
1796
+ <span class="ruby-identifier">i</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">length</span> <span class="ruby-operator">-</span> <span class="ruby-value">1</span>
1797
+ <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">i</span> <span class="ruby-operator">&gt;=</span> <span class="ruby-value">0</span>
1798
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-identifier">i</span><span class="ruby-operator">+</span><span class="ruby-value">1</span>,<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>))
1799
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">i</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">fetch</span>(<span class="ruby-identifier">i</span>) <span class="ruby-operator">==</span> <span class="ruby-identifier">e</span>
1800
+ <span class="ruby-identifier">i</span> <span class="ruby-operator">-=</span> <span class="ruby-value">1</span>
1801
+ <span class="ruby-keyword kw">end</span>
1802
+ <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">set</span>(<span class="ruby-value">0</span>,<span class="ruby-identifier">e</span>)
1803
+ <span class="ruby-keyword kw">self</span>
1804
+ <span class="ruby-keyword kw">end</span>
1805
+ </pre>
1806
+ </div>
1807
+ </div>
1808
+ </div>
1809
+
1810
+ <div id="method-M000303" class="method-detail">
1811
+ <a name="M000303"></a>
1812
+
1813
+ <div class="method-heading">
1814
+ <a href="#M000303" class="method-signature">
1815
+ <span class="method-name">values_at</span><span class="method-args">(*ix)</span>
1816
+ </a>
1817
+ </div>
1818
+
1819
+ <div class="method-description">
1820
+ <p><a class="source-toggle" href="#"
1821
+ onclick="toggleCode('M000303-source');return false;">[Source]</a></p>
1822
+ <div class="method-source-code" id="M000303-source">
1823
+ <pre>
1824
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 501</span>
1825
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">values_at</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">ix</span>)
1826
+ <span class="ruby-identifier">nha</span> = <span class="ruby-constant">HArray</span>.<span class="ruby-identifier">new</span>
1827
+ <span class="ruby-identifier">ix</span>.<span class="ruby-identifier">each</span> {<span class="ruby-operator">|</span><span class="ruby-identifier">i</span><span class="ruby-operator">|</span> <span class="ruby-identifier">nha</span>[<span class="ruby-identifier">nha</span>.<span class="ruby-identifier">length</span>] = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">at</span>(<span class="ruby-identifier">i</span>)}
1828
+ <span class="ruby-identifier">nha</span>
1829
+ <span class="ruby-keyword kw">end</span>
1830
+ </pre>
1831
+ </div>
1832
+ </div>
1833
+ </div>
1834
+
1835
+ <div id="method-M000255" class="method-detail">
1836
+ <a name="M000255"></a>
1837
+
1838
+ <div class="method-heading">
1839
+ <a href="#M000255" class="method-signature">
1840
+ <span class="method-name">|</span><span class="method-args">(ha)</span>
1841
+ </a>
1842
+ </div>
1843
+
1844
+ <div class="method-description">
1845
+ <p><a class="source-toggle" href="#"
1846
+ onclick="toggleCode('M000255-source');return false;">[Source]</a></p>
1847
+ <div class="method-source-code" id="M000255-source">
1848
+ <pre>
1849
+ <span class="ruby-comment cmt"># File lib/carat/harray.rb, line 129</span>
1850
+ <span class="ruby-keyword kw">def</span> <span class="ruby-operator">|</span>(<span class="ruby-identifier">ha</span>)
1851
+ <span class="ruby-identifier">nha</span> = <span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">dup</span>
1852
+ <span class="ruby-identifier">ha</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">v</span><span class="ruby-operator">|</span> <span class="ruby-identifier">nha</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">v</span> <span class="ruby-keyword kw">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">nha</span>.<span class="ruby-identifier">has_value?</span>(<span class="ruby-identifier">v</span>) }
1853
+ <span class="ruby-identifier">nha</span>
1854
+ <span class="ruby-keyword kw">end</span>
1855
+ </pre>
1856
+ </div>
1857
+ </div>
1858
+ </div>
1859
+
1860
+
1861
+ </div>
1862
+
1863
+
1864
+ </div>
1865
+
1866
+
1867
+ <div id="validator-badges">
1868
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
1869
+ </div>
1870
+
1871
+ </body>
1872
+ </html>